Module malachite_base::num::arithmetic::parity
source · Expand description
Parity
, a trait for determining whether a number is even or odd.
§even
use malachite_base::num::arithmetic::traits::Parity;
assert_eq!(0u8.even(), true);
assert_eq!((-5i16).even(), false);
assert_eq!(4u32.even(), true);
§odd
use malachite_base::num::arithmetic::traits::Parity;
assert_eq!(0u8.odd(), false);
assert_eq!((-5i16).odd(), true);
assert_eq!(4u32.odd(), false);