Module malachite_base::num::arithmetic::neg
source · Expand description
NegAssign
, a trait for negating a number in place.
§neg_assign
use malachite_base::num::arithmetic::traits::NegAssign;
let mut x = 0i8;
x.neg_assign();
assert_eq!(x, 0i8);
let mut x = 100i64;
x.neg_assign();
assert_eq!(x, -100i64);
let mut x = -100i64;
x.neg_assign();
assert_eq!(x, 100i64);
let mut x = 1.2f32;
x.neg_assign();
assert_eq!(x, -1.2f32);