sgn

Returns -1 if x < 0, x if x == 0, 1 if x > 0, and NaN if x==NaN.

@safe pure nothrow @nogc
F
sgn
(
F
)
(
F x
)

Examples

assert(sgn(168.1234) == 1);
assert(sgn(-168.1234) == -1);
assert(sgn(0.0) == 0);
assert(sgn(-0.0) == 0);

Meta