Module malachite_base::num::arithmetic::overflowing_pow
source · Expand description
OverflowingPow
and
OverflowingPowAssign
, traits for raising a number to a power
and returning a boolean indicating whether an overflow occurred.
§overflowing_pow_assign
use malachite_base::num::arithmetic::traits::OverflowingPowAssign;
let mut x = 3u8;
assert_eq!(x.overflowing_pow_assign(3), false);
assert_eq!(x, 27);
let mut x = -10i32;
assert_eq!(x.overflowing_pow_assign(9), false);
assert_eq!(x, -1000000000);
let mut x = -10i16;
assert_eq!(x.overflowing_pow_assign(9), true);
assert_eq!(x, 13824);