Module malachite_base::num::arithmetic::is_power_of_2
source · Expand description
IsPowerOf2
, a trait for determining whether a number is an integer power
of 2.
§is_power_of_2
use malachite_base::num::arithmetic::traits::IsPowerOf2;
assert_eq!(4.0.is_power_of_2(), true);
assert_eq!(0.25.is_power_of_2(), true);
assert_eq!(0.2.is_power_of_2(), false);
assert_eq!((-4.0).is_power_of_2(), false);