Module malachite_base::num::arithmetic::gcd
source · Expand description
Gcd
and GcdAssign
, traits for computing the GCD
(greatest common divisor) of two numbers.
§gcd
use malachite_base::num::arithmetic::traits::Gcd;
assert_eq!(3u8.gcd(5), 1);
assert_eq!(12u16.gcd(90), 6);
§gcd_assign
use malachite_base::num::arithmetic::traits::GcdAssign;
let mut x = 3u8;
x.gcd_assign(5);
assert_eq!(x, 1);
let mut x = 12u16;
x.gcd_assign(90);
assert_eq!(x, 6);