Module malachite_base::num::arithmetic::sub_mul
source · Expand description
SubMul
and SubMulAssign
, traits for subtracting
the product of two numbers from a number.
§sub_mul
use malachite_base::num::arithmetic::traits::SubMul;
assert_eq!(60u32.sub_mul(5, 10), 10);
assert_eq!(127i8.sub_mul(2, 100), -73);
assert_eq!(1.0f32.sub_mul(2.0, 3.0), -5.0);
§sub_mul_assign
use malachite_base::num::arithmetic::traits::SubMulAssign;
let mut x = 60u32;
x.sub_mul_assign(5, 10);
assert_eq!(x, 10);
let mut x = 127i8;
x.sub_mul_assign(2, 100);
assert_eq!(x, -73);
let mut x = 1.0f32;
x.sub_mul_assign(2.0, 3.0);
assert_eq!(x, -5.0);