Trait dashu::integer::ops::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

§

type Output = u8

source§

fn gcd(self, rhs: u8) -> <u8 as Gcd>::Output

source§

impl Gcd for u16

§

type Output = u16

source§

fn gcd(self, rhs: u16) -> <u16 as Gcd>::Output

source§

impl Gcd for u32

§

type Output = u32

source§

fn gcd(self, rhs: u32) -> <u32 as Gcd>::Output

source§

impl Gcd for u64

§

type Output = u64

source§

fn gcd(self, rhs: u64) -> <u64 as Gcd>::Output

source§

impl Gcd for u128

§

type Output = u128

source§

fn gcd(self, rhs: u128) -> <u128 as Gcd>::Output

source§

impl Gcd for usize

§

type Output = usize

source§

fn gcd(self, rhs: usize) -> <usize as Gcd>::Output

Implementors§

source§

impl Gcd for IBig

§

type Output = UBig

source§

impl Gcd for UBig

§

type Output = UBig

source§

impl Gcd<IBig> for UBig

§

type Output = UBig

source§

impl Gcd<UBig> for IBig

§

type Output = UBig

source§

impl<'l> Gcd<IBig> for &'l IBig

§

type Output = UBig

source§

impl<'l> Gcd<IBig> for &'l UBig

§

type Output = UBig

source§

impl<'l> Gcd<UBig> for &'l IBig

§

type Output = UBig

source§

impl<'l> Gcd<UBig> for &'l UBig

§

type Output = UBig

source§

impl<'l, 'r> Gcd<&'r IBig> for &'l IBig

§

type Output = UBig

source§

impl<'l, 'r> Gcd<&'r IBig> for &'l UBig

§

type Output = UBig

source§

impl<'l, 'r> Gcd<&'r UBig> for &'l IBig

§

type Output = UBig

source§

impl<'l, 'r> Gcd<&'r UBig> for &'l UBig

§

type Output = UBig

source§

impl<'r> Gcd<&'r IBig> for IBig

§

type Output = UBig

source§

impl<'r> Gcd<&'r IBig> for UBig

§

type Output = UBig

source§

impl<'r> Gcd<&'r UBig> for IBig

§

type Output = UBig

source§

impl<'r> Gcd<&'r UBig> for UBig

§

type Output = UBig