magn

Returns the magnitude of a complex number.

Convenience function that calls hypot() either with a clfloat, a cdouble or a std.complex.Complex.

magn
(
T
)
(
T t
)
if (
is(T == cfloat) ||
is(T == cdouble)
||
is(T == Complex!float)
||
is(T == Complex!double)
)

Examples

assert(magn(cdouble(3.0+4.0i)) == 5.0);
assert(magn(cfloat(3.0f+4.0fi)) == 5.0f);
assert(magn(complex(3.0f,4.0f)) == 5.0f);
assert(magn(complex(3.0,4.0)) == 5.0);

Meta