Module malachite_base::num::arithmetic::sign
source · Expand description
Sign
, a trait for determining the sign of a number.
§sign
use malachite_base::num::arithmetic::traits::Sign;
use malachite_base::num::basic::traits::NegativeInfinity;
use std::cmp::Ordering::*;
assert_eq!(0u8.sign(), Equal);
assert_eq!(100u64.sign(), Greater);
assert_eq!((-100i16).sign(), Less);
assert_eq!(0.0.sign(), Greater);
assert_eq!(1.0.sign(), Greater);
assert_eq!(f64::INFINITY.sign(), Greater);
assert_eq!((-0.0).sign(), Less);
assert_eq!((-1.0).sign(), Less);
assert_eq!(f64::NEGATIVE_INFINITY.sign(), Less);
assert_eq!(f64::NAN.sign(), Equal);