Module malachite_base::num::arithmetic::checked_sub_mul
source · Expand description
CheckedSubMul
, a trait for subtracting the product of two numbers
from another number, and checking whether the result is representable.
§checked_sub_mul
use malachite_base::num::arithmetic::traits::CheckedSubMul;
assert_eq!(60u8.checked_sub_mul(5, 10), Some(10));
assert_eq!(2u8.checked_sub_mul(10, 5), None);
assert_eq!(127i8.checked_sub_mul(2, 100), Some(-73));
assert_eq!((-127i8).checked_sub_mul(2, 100), None);