[][src]Trait gcd::Gcd

pub trait Gcd {
    fn gcd(self, other: Self) -> Self;
fn gcd_binary(self, other: Self) -> Self;
fn gcd_euclid(self, other: Self) -> Self; }

Required methods

fn gcd(self, other: Self) -> Self

Determine greatest common divisor using the Euclidean algorithm

Examples

use gcd::Gcd;

assert_eq!(0, 0u8.gcd(0));
assert_eq!(10, 10u8.gcd(0));
assert_eq!(10, 0u8.gcd(10));
assert_eq!(10, 10u8.gcd(20));
assert_eq!(44, 2024u32.gcd(748));

fn gcd_binary(self, other: Self) -> Self

fn gcd_euclid(self, other: Self) -> Self

Loading content...

Implementors

impl Gcd for u8[src]

impl Gcd for u16[src]

impl Gcd for u32[src]

impl Gcd for u64[src]

impl Gcd for u128[src]

impl Gcd for usize[src]

Loading content...