Module malachite_base::num::arithmetic::checked_add_mul
source · Expand description
CheckedAddMul
, a trait for adding a number and the product of two
other numbers, and checking whether the result is representable.
§checked_add_mul
use malachite_base::num::arithmetic::traits::CheckedAddMul;
assert_eq!(2u8.checked_add_mul(3, 7), Some(23));
assert_eq!(2u8.checked_add_mul(20, 20), None);
assert_eq!(127i8.checked_add_mul(-2, 100), Some(-73));
assert_eq!((-127i8).checked_add_mul(-2, 100), None);