Module malachite_base::num::arithmetic::mod_neg
source · Expand description
ModNeg
and ModNegAssign
, traits for negating a
number modulo another number.
§mod_neg
use malachite_base::num::arithmetic::traits::ModNeg;
assert_eq!(0u8.mod_neg(5), 0);
assert_eq!(7u32.mod_neg(10), 3);
assert_eq!(100u16.mod_neg(101), 1);
§mod_neg_assign
use malachite_base::num::arithmetic::traits::ModNegAssign;
let mut n = 0u8;
n.mod_neg_assign(5);
assert_eq!(n, 0);
let mut n = 7u32;
n.mod_neg_assign(10);
assert_eq!(n, 3);
let mut n = 100u16;
n.mod_neg_assign(101);
assert_eq!(n, 1);