Module malachite_base::num::arithmetic::add_mul
source · Expand description
AddMul
and AddMulAssign
, traits for adding a
number and the product of two other numbers.
§add_mul
use malachite_base::num::arithmetic::traits::AddMul;
assert_eq!(2u8.add_mul(3, 7), 23);
assert_eq!(127i8.add_mul(-2, 100), -73);
assert_eq!(1.0f32.add_mul(2.0, 3.0), 7.0);
§add_mul_assign
use malachite_base::num::arithmetic::traits::AddMulAssign;
let mut x = 2u8;
x.add_mul_assign(3, 7);
assert_eq!(x, 23);
let mut x = 127i8;
x.add_mul_assign(-2, 100);
assert_eq!(x, -73);
let mut x = 1.0f32;
x.add_mul_assign(2.0, 3.0);
assert_eq!(x, 7.0);