Module malachite_base::num::arithmetic::mod_sub
source · Expand description
ModSub
and ModSubAssign
, traits for subtracting
two numbers modulo another number.
§mod_sub
use malachite_base::num::arithmetic::traits::ModSub;
assert_eq!(4u8.mod_sub(3, 5), 1);
assert_eq!(7u32.mod_sub(9, 10), 8);
§mod_sub_assign
use malachite_base::num::arithmetic::traits::ModSubAssign;
let mut n = 4u8;
n.mod_sub_assign(3, 5);
assert_eq!(n, 1);
let mut n = 7u32;
n.mod_sub_assign(9, 10);
assert_eq!(n, 8);