A complex number
The squared magnitude of z.
import std.math.operations : isClose; import std.math.constants : PI; assert(norm(complex(3.0, 4.0)) == 25.0); assert(norm(fromPolar(5.0, 0.0)) == 25.0); assert(isClose(norm(fromPolar(5.0L, PI / 6)), 25.0L)); assert(isClose(norm(fromPolar(5.0L, 13 * PI / 6)), 25.0L));
Extracts the norm of a complex number.