View source code
Display the source code in std/complex.d from which this page was generated on github.
Report a bug
If you spot a problem with this page, click here to create a Bugzilla issue.
Improve this page
Quickly fork, edit online, and submit a pull request for this page. Requires a signed-in GitHub account. This works well for small changes. If you'd like to make larger changes you may want to consider using local clone.

Function std.complex.log10

Calculate the base-10 logarithm of x.

Complex!T log10(T) (
  Complex!T x
) pure nothrow @nogc @safe;


x A complex number


The complex base 10 logarithm of x


import core.math : sqrt;
import std.math.constants : LN10, PI;
import std.math.operations : isClose;

auto a = complex(2.0, 1.0);
writeln(log10(a)); // log(a) / log(complex(10.0))

auto b = log10(complex(0.0, 1.0)) * 2.0;
auto c = log10(complex(sqrt(2.0) / 2, sqrt(2.0) / 2)) * 4.0;
assert(isClose(b, c, 0.0, 1e-15));


Lars Tandle Kyllingstad, Don Clugston


Boost License 1.0