fromPolar

Constructs a complex number given its absolute value and argument.

@safe pure nothrow @nogc
fromPolar
(
T
U
)
(
const T modulus
,
const U argument
)

Parameters

modulus T

The modulus

argument U

The argument

Return Value

Type: Complex!(CommonType!(T, U))

The complex number with the given modulus and argument.

Examples

import std.math;
auto z = fromPolar(std.math.sqrt(2.0), PI_4);
assert(approxEqual(z.re, 1.0L, real.epsilon));
assert(approxEqual(z.im, 1.0L, real.epsilon));

Meta

Suggestion Box / Bug Report