std::log10(std::complex) - cppreference.com (original) (raw)

C++

Compiler support
Freestanding and hosted
Language
Standard library
Standard library headers
Named requirements
Feature test macros (C++20)
Language support library
Concepts library (C++20)
Diagnostics library
Memory management library
Metaprogramming library (C++11)
General utilities library
Containers library
Iterators library
Ranges library (C++20)
Algorithms library
Strings library
Text processing library
Numerics library
Date and time library
Input/output library
Filesystem library (C++17)
Concurrency support library (C++11)
Execution control library (C++26)
Technical specifications
Symbols index
External libraries

[edit]

Numerics library

Common mathematical functions
Mathematical special functions (C++17)
Mathematical constants (C++20)
Basic linear algebra algorithms (C++26)
Data-parallel types (SIMD) (C++26)
Floating-point environment (C++11)
Complex numbers
Numeric array (valarray)
Pseudo-random number generation
Bit manipulation (C++20)
Saturation arithmetic (C++26)
Factor operations
gcd(C++17) lcm(C++17)
Interpolations
midpoint(C++20) lerp(C++20)
Generic numeric operations
iota(C++11) ranges::iota(C++23) accumulate inner_product adjacent_difference partial_sum reduce(C++17) transform_reduce(C++17) inclusive_scan(C++17) exclusive_scan(C++17) transform_inclusive_scan(C++17) transform_exclusive_scan(C++17)
C-style checked integer arithmetic
ckd_add(C++26) ckd_sub(C++26) ckd_mul(C++26)

[edit]

std::complex

Member functions
complex::complex complex::operator= complex::real complex::imag complex::operator+=complex::operator-=complex::operator*=complex::operator/=
Non-member functions
operator+operator- operator+operator-operator*operator/ operator==operator!=(until C++20) operator<> get(std::complex)(C++26) real imag abs arg norm conj proj(C++11) polar [operator""ioperator""ifoperator""il](operator%2522%2522i.html "cpp/numeric/complex/operator""i")(C++14)(C++14)(C++14)
Exponential functions
loglog10exp
Power functions
powsqrt
Trigonometric functions
sin cos tan asin(C++11) acos(C++11) atan(C++11)
Hyperbolic functions
sinh cosh tanh asinh(C++11) acosh(C++11) atanh(C++11)
Helper types
tuple_sizestd::complex(C++26)
tuple_elementstd::complex(C++26)

[edit]

| Defined in header | | | | --------------------------------------------------------------------------------------------------------------- | | | | template< class T > std::complex<T> log10( const std::complex<T>& z ); | | |

Computes complex common (base 10) logarithm of a complex value z with a branch cut along the negative real axis.

The behavior of this function is equivalent to [std::log](log.html "cpp/numeric/complex/log")(z) / [std::log](../math/log.html "cpp/numeric/math/log")(T(10)).

Contents

[edit] Parameters

z - complex value

[edit] Return value

Complex common logarithm of z.

[edit] Example

Run this code

#include #include #include   int main() { std::complex z(0.0, 1.0); // r = 0, θ = pi / 2 std::cout << "2 * log10" << z << " = " << 2.0 * std::log10(z) << '\n';   std::complex z2(sqrt(2.0) / 2, sqrt(2.0) / 2); // r = 1, θ = pi / 4 std::cout << "4 * log10" << z2 << " = " << 4.0 * std::log10(z2) << '\n';   std::complex z3(-100.0, 0.0); // r = 100, θ = pi std::cout << "log10" << z3 << " = " << std::log10(z3) << '\n'; std::complex z4(-100.0, -0.0); // the other side of the cut std::cout << "log10" << z4 << " = " << std::log10(z4) << " " "(the other side of the cut)\n" "(note: pi / log(10) = " << std::acos(-1.0) / std::log(10.0) << ")\n"; }

Possible output:

2 * log10(0,1) = (0,1.36438) 4 * log10(0.707107,0.707107) = (0,1.36438) log10(-100,0) = (2,1.36438) log10(-100,-0) = (2,-1.36438) (the other side of the cut) (note: pi / log(10) = 1.36438)

[edit] See also

log(std::complex) complex natural logarithm with the branch cuts along the negative real axis (function template) [edit]
log10log10flog10l(C++11)(C++11) computes common (base 10) logarithm (\({\small\log_{10}{x}}\)log10(x)) (function) [edit]
log10(std::valarray) applies the function std::log10 to each element of valarray (function template) [edit]