Module malachite_base::num::arithmetic::overflowing_square
source · Expand description
OverflowingSquare
and
OverflowingSquareAssign
, traits for squaring a number and
returning a boolean indicating whether an overflow occurred.
§overflowing_square_assign
use malachite_base::num::arithmetic::traits::OverflowingSquareAssign;
let mut x = 3u8;
assert_eq!(x.overflowing_square_assign(), false);
assert_eq!(x, 9);
let mut x = -1000i32;
assert_eq!(x.overflowing_square_assign(), false);
assert_eq!(x, 1000000);
let mut x = 1000u16;
assert_eq!(x.overflowing_square_assign(), true);
assert_eq!(x, 16960);