std::log10(std::complex)

< cpp‎ | numeric‎ | complex

C++
 Language Standard library headers Concepts Utilities library Strings library Containers library Algorithms library Iterators library Numerics library Input/output library Localizations library Regular expressions library (C++11) Atomic operations library (C++11) Thread support library (C++11) Technical Specifications

Numerics library
 Common mathematical functions Floating-point environment Complex numbers Numeric arrays Pseudo-random number generation Compile-time rational arithmetic (C++11) Generic numeric operations iota (C++11) accumulate inner_product adjacent_difference partial_sum

std::complex
Member functions
Non-member functions
 real imag abs arg norm conj proj (C++11) polar operator""ioperator""ifoperator""il (C++14)(C++14)(C++14)
Exponential functions
log10
Power functions
Trigonometric functions
 asin (C++11) acos (C++11) atan (C++11)
Hyperbolic functions
 asinh (C++11) acosh (C++11) atanh (C++11)

 Defined in header `` template< class T > complex log10( const complex& 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(z)/std::log(10)`

Contents

Parameters

 z - complex value

Return value

Complex common logarithm of `z`

Example

```#include <iostream>
#include <cmath>
#include <complex>

int main()
{
std::complex<double> z(0, 1); // // r = 0,  = pi/2
std::cout << "2*log10" << z << " = " << 2.*std::log10(z) << '\n';

std::complex<double> z2(sqrt(2)/2, sqrt(2)/2); // r = 1, # = pi/4
std::cout << "4*log10" << z2 << " = " << 4.*std::log10(z2) << '\n';

std::complex<double> z3(-100, 0); // r = 100, # = pi
std::cout << "log10" << z3 << " = " << std::log10(z3) << '\n';
std::complex<double> z4(-100, -0.0); // the other side of the cut
std::cout << "log10" << z4 << " (the other side of the cut) = "
<< std::log10(z4) << '\n'
<< "(note: pi/log(10) = " << acos(-1)/log(10) << ")\n";
}```

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) (the other side of the cut) = (2,-1.36438)
(note: pi/log(10) = 1.36438)```