The OpenD Programming Language

log

Calculate the natural logarithm of x. The branch cut is along the negative axis.

@safe pure nothrow @nogc
Complex!T
log
(
T
)
(
Complex!T x
)

Parameters

x Complex!T

A complex number

Return Value

Type: Complex!T

The complex natural logarithm of x

Special Values
xlog(x)
(-0, +0)(-∞, π)
(+0, +0)(-∞, +0)
(any, +∞)(+∞, π/2)
(any, NaN)(NaN, NaN)
(-∞, any)(+∞, π)
(+∞, any)(+∞, +0)
(-∞, +∞)(+∞, 3π/4)
(+∞, +∞)(+∞, π/4)
(±∞, NaN)(+∞, NaN)
(NaN, any)(NaN, NaN)
(NaN, +∞)(+∞, NaN)
(NaN, NaN)(NaN, NaN)

Examples

import mir.math.common: sqrt;
import mir.math.constant: PI;
import mir.math.common: approxEqual;

auto a = complex(2.0, 1.0);
assert(log(conj(a)) == conj(log(a)));

assert(log(complex(-1.0L, 0.0L)) == complex(0.0L, PI));
assert(log(complex(-1.0L, -0.0L)) == complex(0.0L, -PI));

Meta