[−][src]Function num_traits::sign::signum
pub fn signum<T: Signed>(value: T) -> T
Returns the sign of the number.
For f32
and f64
:
1.0
if the number is positive,+0.0
orINFINITY
-1.0
if the number is negative,-0.0
orNEG_INFINITY
NaN
if the number isNaN
For signed integers:
0
if the number is zero1
if the number is positive-1
if the number is negative