A complex number
The complex base e exponential of x
| x | exp(x) |
|---|---|
| (±0, +0) | (1, +0) |
| (any, +∞) | (NaN, NaN) |
| (any, NaN) | (NaN, NaN) |
| (+∞, +0) | (+∞, +0) |
| (-∞, any) | (±0, cis(x.im)) |
| (+∞, any) | (±∞, cis(x.im)) |
| (-∞, +∞) | (±0, ±0) |
| (+∞, +∞) | (±∞, NaN) |
| (-∞, NaN) | (±0, ±0) |
| (+∞, NaN) | (±∞, NaN) |
| (NaN, +0) | (NaN, +0) |
| (NaN, any) | (NaN, NaN) |
| (NaN, NaN) | (NaN, NaN) |
import std.math.operations : isClose; import std.math.constants : PI; assert(exp(complex(0.0, 0.0)) == complex(1.0, 0.0)); auto a = complex(2.0, 1.0); assert(exp(conj(a)) == conj(exp(a))); auto b = exp(complex(0.0L, 1.0L) * PI); assert(isClose(b, -1.0L, 0.0, 1e-15));
Calculates ex.