Gcd

Trait Gcd 

Source
pub trait Gcd<Rhs = Self> {
    type Output;

    // Required method
    fn gcd(self, rhs: Rhs) -> Self::Output;
}
Expand description

Compute the greatest common divisor.

For negative integers, the common divisor is still kept positive.

§Examples

use dashu_base::Gcd;
assert_eq!(12u8.gcd(10u8), 2);

§Panics

Panics if both operands are zeros

Required Associated Types§

Required Methods§

Source

fn gcd(self, rhs: Rhs) -> Self::Output

Compute the greatest common divisor between the two operands.

Panics if both operands are zeros

Implementations on Foreign Types§

Source§

impl Gcd for u8

Source§

type Output = u8

Source§

fn gcd(self, rhs: Self) -> Self::Output

Source§

impl Gcd for u16

Source§

type Output = u16

Source§

fn gcd(self, rhs: Self) -> Self::Output

Source§

impl Gcd for u32

Source§

type Output = u32

Source§

fn gcd(self, rhs: Self) -> Self::Output

Source§

impl Gcd for u64

Source§

type Output = u64

Source§

fn gcd(self, rhs: Self) -> Self::Output

Source§

impl Gcd for u128

Source§

type Output = u128

Source§

fn gcd(self, rhs: Self) -> Self::Output

Source§

impl Gcd for usize

Source§

type Output = usize

Source§

fn gcd(self, rhs: Self) -> Self::Output

Implementors§