The OpenD Programming Language

fromPolar

Constructs a complex number given its absolute value and argument.

@safe pure nothrow @nogc
fromPolar
(
T
)
(
const T modulus
,
const T argument
)
if (
__traits(isFloating, T)
)

Parameters

modulus T

The modulus

argument T

The argument

Return Value

Type: Complex!T

The complex number with the given modulus and argument.

Examples

import mir.math : approxEqual, PI, sqrt;
auto z = fromPolar(sqrt(2.0), double(PI / 4));
assert(approxEqual(z.re, 1.0));
assert(approxEqual(z.im, 1.0));

Meta