Trait num::integer::Integer[][src]

pub trait Integer: Num + PartialOrd<Self> + Ord + Eq {
    pub fn div_floor(&self, other: &Self) -> Self;
pub fn mod_floor(&self, other: &Self) -> Self;
pub fn gcd(&self, other: &Self) -> Self;
pub fn lcm(&self, other: &Self) -> Self;
pub fn divides(&self, other: &Self) -> bool;
pub fn is_multiple_of(&self, other: &Self) -> bool;
pub fn is_even(&self) -> bool;
pub fn is_odd(&self) -> bool;
pub fn div_rem(&self, other: &Self) -> (Self, Self); pub fn div_ceil(&self, other: &Self) -> Self { ... }
pub fn gcd_lcm(&self, other: &Self) -> (Self, Self) { ... }
pub fn extended_gcd(&self, other: &Self) -> ExtendedGcd<Self>
    where
        Self: Clone
, { ... }
pub fn extended_gcd_lcm(&self, other: &Self) -> (ExtendedGcd<Self>, Self)
    where
        Self: Clone + Signed
, { ... }
pub fn div_mod_floor(&self, other: &Self) -> (Self, Self) { ... }
pub fn next_multiple_of(&self, other: &Self) -> Self
    where
        Self: Clone
, { ... }
pub fn prev_multiple_of(&self, other: &Self) -> Self
    where
        Self: Clone
, { ... } }

Required methods

pub fn div_floor(&self, other: &Self) -> Self[src]

Floored integer division.

Examples

assert!(( 8).div_floor(& 3) ==  2);
assert!(( 8).div_floor(&-3) == -3);
assert!((-8).div_floor(& 3) == -3);
assert!((-8).div_floor(&-3) ==  2);

assert!(( 1).div_floor(& 2) ==  0);
assert!(( 1).div_floor(&-2) == -1);
assert!((-1).div_floor(& 2) == -1);
assert!((-1).div_floor(&-2) ==  0);

pub fn mod_floor(&self, other: &Self) -> Self[src]

Floored integer modulo, satisfying:

assert!(n.div_floor(&d) * d + n.mod_floor(&d) == n)

Examples

assert!(( 8).mod_floor(& 3) ==  2);
assert!(( 8).mod_floor(&-3) == -1);
assert!((-8).mod_floor(& 3) ==  1);
assert!((-8).mod_floor(&-3) == -2);

assert!(( 1).mod_floor(& 2) ==  1);
assert!(( 1).mod_floor(&-2) == -1);
assert!((-1).mod_floor(& 2) ==  1);
assert!((-1).mod_floor(&-2) == -1);

pub fn gcd(&self, other: &Self) -> Self[src]

Greatest Common Divisor (GCD).

Examples

assert_eq!(6.gcd(&8), 2);
assert_eq!(7.gcd(&3), 1);

pub fn lcm(&self, other: &Self) -> Self[src]

Lowest Common Multiple (LCM).

Examples

assert_eq!(7.lcm(&3), 21);
assert_eq!(2.lcm(&4), 4);
assert_eq!(0.lcm(&0), 0);

pub fn divides(&self, other: &Self) -> bool[src]

Deprecated, use is_multiple_of instead.

pub fn is_multiple_of(&self, other: &Self) -> bool[src]

Returns true if self is a multiple of other.

Examples

assert_eq!(9.is_multiple_of(&3), true);
assert_eq!(3.is_multiple_of(&9), false);

pub fn is_even(&self) -> bool[src]

Returns true if the number is even.

Examples

assert_eq!(3.is_even(), false);
assert_eq!(4.is_even(), true);

pub fn is_odd(&self) -> bool[src]

Returns true if the number is odd.

Examples

assert_eq!(3.is_odd(), true);
assert_eq!(4.is_odd(), false);

pub fn div_rem(&self, other: &Self) -> (Self, Self)[src]

Simultaneous truncated integer division and modulus. Returns (quotient, remainder).

Examples

assert_eq!(( 8).div_rem( &3), ( 2,  2));
assert_eq!(( 8).div_rem(&-3), (-2,  2));
assert_eq!((-8).div_rem( &3), (-2, -2));
assert_eq!((-8).div_rem(&-3), ( 2, -2));

assert_eq!(( 1).div_rem( &2), ( 0,  1));
assert_eq!(( 1).div_rem(&-2), ( 0,  1));
assert_eq!((-1).div_rem( &2), ( 0, -1));
assert_eq!((-1).div_rem(&-2), ( 0, -1));
Loading content...

Provided methods

pub fn div_ceil(&self, other: &Self) -> Self[src]

Ceiled integer division.

Examples

assert_eq!(( 8).div_ceil( &3),  3);
assert_eq!(( 8).div_ceil(&-3), -2);
assert_eq!((-8).div_ceil( &3), -2);
assert_eq!((-8).div_ceil(&-3),  3);

assert_eq!(( 1).div_ceil( &2), 1);
assert_eq!(( 1).div_ceil(&-2), 0);
assert_eq!((-1).div_ceil( &2), 0);
assert_eq!((-1).div_ceil(&-2), 1);

pub fn gcd_lcm(&self, other: &Self) -> (Self, Self)[src]

Greatest Common Divisor (GCD) and Lowest Common Multiple (LCM) together.

Potentially more efficient than calling gcd and lcm individually for identical inputs.

Examples

assert_eq!(10.gcd_lcm(&4), (2, 20));
assert_eq!(8.gcd_lcm(&9), (1, 72));

pub fn extended_gcd(&self, other: &Self) -> ExtendedGcd<Self> where
    Self: Clone
[src]

Greatest common divisor and Bézout coefficients.

Examples

fn check<A: Copy + Integer + NumAssign>(a: A, b: A) -> bool {
    let ExtendedGcd { gcd, x, y, .. } = a.extended_gcd(&b);
    gcd == x * a + y * b
}
assert!(check(10isize, 4isize));
assert!(check(8isize,  9isize));

pub fn extended_gcd_lcm(&self, other: &Self) -> (ExtendedGcd<Self>, Self) where
    Self: Clone + Signed
[src]

Greatest common divisor, least common multiple, and Bézout coefficients.

pub fn div_mod_floor(&self, other: &Self) -> (Self, Self)[src]

Simultaneous floored integer division and modulus. Returns (quotient, remainder).

Examples

assert_eq!(( 8).div_mod_floor( &3), ( 2,  2));
assert_eq!(( 8).div_mod_floor(&-3), (-3, -1));
assert_eq!((-8).div_mod_floor( &3), (-3,  1));
assert_eq!((-8).div_mod_floor(&-3), ( 2, -2));

assert_eq!(( 1).div_mod_floor( &2), ( 0,  1));
assert_eq!(( 1).div_mod_floor(&-2), (-1, -1));
assert_eq!((-1).div_mod_floor( &2), (-1,  1));
assert_eq!((-1).div_mod_floor(&-2), ( 0, -1));

pub fn next_multiple_of(&self, other: &Self) -> Self where
    Self: Clone
[src]

Rounds up to nearest multiple of argument.

Notes

For signed types, a.next_multiple_of(b) = a.prev_multiple_of(b.neg()).

Examples

assert_eq!(( 16).next_multiple_of(& 8),  16);
assert_eq!(( 23).next_multiple_of(& 8),  24);
assert_eq!(( 16).next_multiple_of(&-8),  16);
assert_eq!(( 23).next_multiple_of(&-8),  16);
assert_eq!((-16).next_multiple_of(& 8), -16);
assert_eq!((-23).next_multiple_of(& 8), -16);
assert_eq!((-16).next_multiple_of(&-8), -16);
assert_eq!((-23).next_multiple_of(&-8), -24);

pub fn prev_multiple_of(&self, other: &Self) -> Self where
    Self: Clone
[src]

Rounds down to nearest multiple of argument.

Notes

For signed types, a.prev_multiple_of(b) = a.next_multiple_of(b.neg()).

Examples

assert_eq!(( 16).prev_multiple_of(& 8),  16);
assert_eq!(( 23).prev_multiple_of(& 8),  16);
assert_eq!(( 16).prev_multiple_of(&-8),  16);
assert_eq!(( 23).prev_multiple_of(&-8),  24);
assert_eq!((-16).prev_multiple_of(& 8), -16);
assert_eq!((-23).prev_multiple_of(& 8), -24);
assert_eq!((-16).prev_multiple_of(&-8), -16);
assert_eq!((-23).prev_multiple_of(&-8), -16);
Loading content...

Implementations on Foreign Types

impl Integer for i64[src]

pub fn div_floor(&self, other: &i64) -> i64[src]

Floored integer division

pub fn mod_floor(&self, other: &i64) -> i64[src]

Floored integer modulo

pub fn div_mod_floor(&self, other: &i64) -> (i64, i64)[src]

Calculates div_floor and mod_floor simultaneously

pub fn gcd(&self, other: &i64) -> i64[src]

Calculates the Greatest Common Divisor (GCD) of the number and other. The result is always positive.

pub fn lcm(&self, other: &i64) -> i64[src]

Calculates the Lowest Common Multiple (LCM) of the number and other.

pub fn gcd_lcm(&self, other: &i64) -> (i64, i64)[src]

Calculates the Greatest Common Divisor (GCD) and Lowest Common Multiple (LCM) of the number and other.

pub fn divides(&self, other: &i64) -> bool[src]

Deprecated, use is_multiple_of instead.

pub fn is_multiple_of(&self, other: &i64) -> bool[src]

Returns true if the number is a multiple of other.

pub fn is_even(&self) -> bool[src]

Returns true if the number is divisible by 2

pub fn is_odd(&self) -> bool[src]

Returns true if the number is not divisible by 2

pub fn div_rem(&self, other: &i64) -> (i64, i64)[src]

Simultaneous truncated integer division and modulus.

impl Integer for u16[src]

pub fn div_floor(&self, other: &u16) -> u16[src]

Unsigned integer division. Returns the same result as div (/).

pub fn mod_floor(&self, other: &u16) -> u16[src]

Unsigned integer modulo operation. Returns the same result as rem (%).

pub fn gcd(&self, other: &u16) -> u16[src]

Calculates the Greatest Common Divisor (GCD) of the number and other

pub fn lcm(&self, other: &u16) -> u16[src]

Calculates the Lowest Common Multiple (LCM) of the number and other.

pub fn gcd_lcm(&self, other: &u16) -> (u16, u16)[src]

Calculates the Greatest Common Divisor (GCD) and Lowest Common Multiple (LCM) of the number and other.

pub fn divides(&self, other: &u16) -> bool[src]

Deprecated, use is_multiple_of instead.

pub fn is_multiple_of(&self, other: &u16) -> bool[src]

Returns true if the number is a multiple of other.

pub fn is_even(&self) -> bool[src]

Returns true if the number is divisible by 2.

pub fn is_odd(&self) -> bool[src]

Returns true if the number is not divisible by 2.

pub fn div_rem(&self, other: &u16) -> (u16, u16)[src]

Simultaneous truncated integer division and modulus.

impl Integer for u64[src]

pub fn div_floor(&self, other: &u64) -> u64[src]

Unsigned integer division. Returns the same result as div (/).

pub fn mod_floor(&self, other: &u64) -> u64[src]

Unsigned integer modulo operation. Returns the same result as rem (%).

pub fn gcd(&self, other: &u64) -> u64[src]

Calculates the Greatest Common Divisor (GCD) of the number and other

pub fn lcm(&self, other: &u64) -> u64[src]

Calculates the Lowest Common Multiple (LCM) of the number and other.

pub fn gcd_lcm(&self, other: &u64) -> (u64, u64)[src]

Calculates the Greatest Common Divisor (GCD) and Lowest Common Multiple (LCM) of the number and other.

pub fn divides(&self, other: &u64) -> bool[src]

Deprecated, use is_multiple_of instead.

pub fn is_multiple_of(&self, other: &u64) -> bool[src]

Returns true if the number is a multiple of other.

pub fn is_even(&self) -> bool[src]

Returns true if the number is divisible by 2.

pub fn is_odd(&self) -> bool[src]

Returns true if the number is not divisible by 2.

pub fn div_rem(&self, other: &u64) -> (u64, u64)[src]

Simultaneous truncated integer division and modulus.

impl Integer for u8[src]

pub fn div_floor(&self, other: &u8) -> u8[src]

Unsigned integer division. Returns the same result as div (/).

pub fn mod_floor(&self, other: &u8) -> u8[src]

Unsigned integer modulo operation. Returns the same result as rem (%).

pub fn gcd(&self, other: &u8) -> u8[src]

Calculates the Greatest Common Divisor (GCD) of the number and other

pub fn lcm(&self, other: &u8) -> u8[src]

Calculates the Lowest Common Multiple (LCM) of the number and other.

pub fn gcd_lcm(&self, other: &u8) -> (u8, u8)[src]

Calculates the Greatest Common Divisor (GCD) and Lowest Common Multiple (LCM) of the number and other.

pub fn divides(&self, other: &u8) -> bool[src]

Deprecated, use is_multiple_of instead.

pub fn is_multiple_of(&self, other: &u8) -> bool[src]

Returns true if the number is a multiple of other.

pub fn is_even(&self) -> bool[src]

Returns true if the number is divisible by 2.

pub fn is_odd(&self) -> bool[src]

Returns true if the number is not divisible by 2.

pub fn div_rem(&self, other: &u8) -> (u8, u8)[src]

Simultaneous truncated integer division and modulus.

impl Integer for i128[src]

pub fn div_floor(&self, other: &i128) -> i128[src]

Floored integer division

pub fn mod_floor(&self, other: &i128) -> i128[src]

Floored integer modulo

pub fn div_mod_floor(&self, other: &i128) -> (i128, i128)[src]

Calculates div_floor and mod_floor simultaneously

pub fn gcd(&self, other: &i128) -> i128[src]

Calculates the Greatest Common Divisor (GCD) of the number and other. The result is always positive.

pub fn lcm(&self, other: &i128) -> i128[src]

Calculates the Lowest Common Multiple (LCM) of the number and other.

pub fn gcd_lcm(&self, other: &i128) -> (i128, i128)[src]

Calculates the Greatest Common Divisor (GCD) and Lowest Common Multiple (LCM) of the number and other.

pub fn divides(&self, other: &i128) -> bool[src]

Deprecated, use is_multiple_of instead.

pub fn is_multiple_of(&self, other: &i128) -> bool[src]

Returns true if the number is a multiple of other.

pub fn is_even(&self) -> bool[src]

Returns true if the number is divisible by 2

pub fn is_odd(&self) -> bool[src]

Returns true if the number is not divisible by 2

pub fn div_rem(&self, other: &i128) -> (i128, i128)[src]

Simultaneous truncated integer division and modulus.

impl Integer for i16[src]

pub fn div_floor(&self, other: &i16) -> i16[src]

Floored integer division

pub fn mod_floor(&self, other: &i16) -> i16[src]

Floored integer modulo

pub fn div_mod_floor(&self, other: &i16) -> (i16, i16)[src]

Calculates div_floor and mod_floor simultaneously

pub fn gcd(&self, other: &i16) -> i16[src]

Calculates the Greatest Common Divisor (GCD) of the number and other. The result is always positive.

pub fn lcm(&self, other: &i16) -> i16[src]

Calculates the Lowest Common Multiple (LCM) of the number and other.

pub fn gcd_lcm(&self, other: &i16) -> (i16, i16)[src]

Calculates the Greatest Common Divisor (GCD) and Lowest Common Multiple (LCM) of the number and other.

pub fn divides(&self, other: &i16) -> bool[src]

Deprecated, use is_multiple_of instead.

pub fn is_multiple_of(&self, other: &i16) -> bool[src]

Returns true if the number is a multiple of other.

pub fn is_even(&self) -> bool[src]

Returns true if the number is divisible by 2

pub fn is_odd(&self) -> bool[src]

Returns true if the number is not divisible by 2

pub fn div_rem(&self, other: &i16) -> (i16, i16)[src]

Simultaneous truncated integer division and modulus.

impl Integer for i8[src]

pub fn div_floor(&self, other: &i8) -> i8[src]

Floored integer division

pub fn mod_floor(&self, other: &i8) -> i8[src]

Floored integer modulo

pub fn div_mod_floor(&self, other: &i8) -> (i8, i8)[src]

Calculates div_floor and mod_floor simultaneously

pub fn gcd(&self, other: &i8) -> i8[src]

Calculates the Greatest Common Divisor (GCD) of the number and other. The result is always positive.

pub fn lcm(&self, other: &i8) -> i8[src]

Calculates the Lowest Common Multiple (LCM) of the number and other.

pub fn gcd_lcm(&self, other: &i8) -> (i8, i8)[src]

Calculates the Greatest Common Divisor (GCD) and Lowest Common Multiple (LCM) of the number and other.

pub fn divides(&self, other: &i8) -> bool[src]

Deprecated, use is_multiple_of instead.

pub fn is_multiple_of(&self, other: &i8) -> bool[src]

Returns true if the number is a multiple of other.

pub fn is_even(&self) -> bool[src]

Returns true if the number is divisible by 2

pub fn is_odd(&self) -> bool[src]

Returns true if the number is not divisible by 2

pub fn div_rem(&self, other: &i8) -> (i8, i8)[src]

Simultaneous truncated integer division and modulus.

impl Integer for i32[src]

pub fn div_floor(&self, other: &i32) -> i32[src]

Floored integer division

pub fn mod_floor(&self, other: &i32) -> i32[src]

Floored integer modulo

pub fn div_mod_floor(&self, other: &i32) -> (i32, i32)[src]

Calculates div_floor and mod_floor simultaneously

pub fn gcd(&self, other: &i32) -> i32[src]

Calculates the Greatest Common Divisor (GCD) of the number and other. The result is always positive.

pub fn lcm(&self, other: &i32) -> i32[src]

Calculates the Lowest Common Multiple (LCM) of the number and other.

pub fn gcd_lcm(&self, other: &i32) -> (i32, i32)[src]

Calculates the Greatest Common Divisor (GCD) and Lowest Common Multiple (LCM) of the number and other.

pub fn divides(&self, other: &i32) -> bool[src]

Deprecated, use is_multiple_of instead.

pub fn is_multiple_of(&self, other: &i32) -> bool[src]

Returns true if the number is a multiple of other.

pub fn is_even(&self) -> bool[src]

Returns true if the number is divisible by 2

pub fn is_odd(&self) -> bool[src]

Returns true if the number is not divisible by 2

pub fn div_rem(&self, other: &i32) -> (i32, i32)[src]

Simultaneous truncated integer division and modulus.

impl Integer for usize[src]

pub fn div_floor(&self, other: &usize) -> usize[src]

Unsigned integer division. Returns the same result as div (/).

pub fn mod_floor(&self, other: &usize) -> usize[src]

Unsigned integer modulo operation. Returns the same result as rem (%).

pub fn gcd(&self, other: &usize) -> usize[src]

Calculates the Greatest Common Divisor (GCD) of the number and other

pub fn lcm(&self, other: &usize) -> usize[src]

Calculates the Lowest Common Multiple (LCM) of the number and other.

pub fn gcd_lcm(&self, other: &usize) -> (usize, usize)[src]

Calculates the Greatest Common Divisor (GCD) and Lowest Common Multiple (LCM) of the number and other.

pub fn divides(&self, other: &usize) -> bool[src]

Deprecated, use is_multiple_of instead.

pub fn is_multiple_of(&self, other: &usize) -> bool[src]

Returns true if the number is a multiple of other.

pub fn is_even(&self) -> bool[src]

Returns true if the number is divisible by 2.

pub fn is_odd(&self) -> bool[src]

Returns true if the number is not divisible by 2.

pub fn div_rem(&self, other: &usize) -> (usize, usize)[src]

Simultaneous truncated integer division and modulus.

impl Integer for u32[src]

pub fn div_floor(&self, other: &u32) -> u32[src]

Unsigned integer division. Returns the same result as div (/).

pub fn mod_floor(&self, other: &u32) -> u32[src]

Unsigned integer modulo operation. Returns the same result as rem (%).

pub fn gcd(&self, other: &u32) -> u32[src]

Calculates the Greatest Common Divisor (GCD) of the number and other

pub fn lcm(&self, other: &u32) -> u32[src]

Calculates the Lowest Common Multiple (LCM) of the number and other.

pub fn gcd_lcm(&self, other: &u32) -> (u32, u32)[src]

Calculates the Greatest Common Divisor (GCD) and Lowest Common Multiple (LCM) of the number and other.

pub fn divides(&self, other: &u32) -> bool[src]

Deprecated, use is_multiple_of instead.

pub fn is_multiple_of(&self, other: &u32) -> bool[src]

Returns true if the number is a multiple of other.

pub fn is_even(&self) -> bool[src]

Returns true if the number is divisible by 2.

pub fn is_odd(&self) -> bool[src]

Returns true if the number is not divisible by 2.

pub fn div_rem(&self, other: &u32) -> (u32, u32)[src]

Simultaneous truncated integer division and modulus.

impl Integer for u128[src]

pub fn div_floor(&self, other: &u128) -> u128[src]

Unsigned integer division. Returns the same result as div (/).

pub fn mod_floor(&self, other: &u128) -> u128[src]

Unsigned integer modulo operation. Returns the same result as rem (%).

pub fn gcd(&self, other: &u128) -> u128[src]

Calculates the Greatest Common Divisor (GCD) of the number and other

pub fn lcm(&self, other: &u128) -> u128[src]

Calculates the Lowest Common Multiple (LCM) of the number and other.

pub fn gcd_lcm(&self, other: &u128) -> (u128, u128)[src]

Calculates the Greatest Common Divisor (GCD) and Lowest Common Multiple (LCM) of the number and other.

pub fn divides(&self, other: &u128) -> bool[src]

Deprecated, use is_multiple_of instead.

pub fn is_multiple_of(&self, other: &u128) -> bool[src]

Returns true if the number is a multiple of other.

pub fn is_even(&self) -> bool[src]

Returns true if the number is divisible by 2.

pub fn is_odd(&self) -> bool[src]

Returns true if the number is not divisible by 2.

pub fn div_rem(&self, other: &u128) -> (u128, u128)[src]

Simultaneous truncated integer division and modulus.

impl Integer for isize[src]

pub fn div_floor(&self, other: &isize) -> isize[src]

Floored integer division

pub fn mod_floor(&self, other: &isize) -> isize[src]

Floored integer modulo

pub fn div_mod_floor(&self, other: &isize) -> (isize, isize)[src]

Calculates div_floor and mod_floor simultaneously

pub fn gcd(&self, other: &isize) -> isize[src]

Calculates the Greatest Common Divisor (GCD) of the number and other. The result is always positive.

pub fn lcm(&self, other: &isize) -> isize[src]

Calculates the Lowest Common Multiple (LCM) of the number and other.

pub fn gcd_lcm(&self, other: &isize) -> (isize, isize)[src]

Calculates the Greatest Common Divisor (GCD) and Lowest Common Multiple (LCM) of the number and other.

pub fn divides(&self, other: &isize) -> bool[src]

Deprecated, use is_multiple_of instead.

pub fn is_multiple_of(&self, other: &isize) -> bool[src]

Returns true if the number is a multiple of other.

pub fn is_even(&self) -> bool[src]

Returns true if the number is divisible by 2

pub fn is_odd(&self) -> bool[src]

Returns true if the number is not divisible by 2

pub fn div_rem(&self, other: &isize) -> (isize, isize)[src]

Simultaneous truncated integer division and modulus.

Loading content...

Implementors

impl Integer for BigInt[src]

pub fn gcd(&self, other: &BigInt) -> BigInt[src]

Calculates the Greatest Common Divisor (GCD) of the number and other.

The result is always positive.

pub fn lcm(&self, other: &BigInt) -> BigInt[src]

Calculates the Lowest Common Multiple (LCM) of the number and other.

pub fn gcd_lcm(&self, other: &BigInt) -> (BigInt, BigInt)[src]

Calculates the Greatest Common Divisor (GCD) and Lowest Common Multiple (LCM) together.

pub fn extended_gcd_lcm(&self, other: &BigInt) -> (ExtendedGcd<BigInt>, BigInt)[src]

Greatest common divisor, least common multiple, and Bézout coefficients.

pub fn divides(&self, other: &BigInt) -> bool[src]

Deprecated, use is_multiple_of instead.

pub fn is_multiple_of(&self, other: &BigInt) -> bool[src]

Returns true if the number is a multiple of other.

pub fn is_even(&self) -> bool[src]

Returns true if the number is divisible by 2.

pub fn is_odd(&self) -> bool[src]

Returns true if the number is not divisible by 2.

pub fn next_multiple_of(&self, other: &BigInt) -> BigInt[src]

Rounds up to nearest multiple of argument.

pub fn prev_multiple_of(&self, other: &BigInt) -> BigInt[src]

Rounds down to nearest multiple of argument.

impl Integer for BigUint[src]

pub fn gcd(&self, other: &BigUint) -> BigUint[src]

Calculates the Greatest Common Divisor (GCD) of the number and other.

The result is always positive.

pub fn lcm(&self, other: &BigUint) -> BigUint[src]

Calculates the Lowest Common Multiple (LCM) of the number and other.

pub fn gcd_lcm(&self, other: &BigUint) -> (BigUint, BigUint)[src]

Calculates the Greatest Common Divisor (GCD) and Lowest Common Multiple (LCM) together.

pub fn divides(&self, other: &BigUint) -> bool[src]

Deprecated, use is_multiple_of instead.

pub fn is_multiple_of(&self, other: &BigUint) -> bool[src]

Returns true if the number is a multiple of other.

pub fn is_even(&self) -> bool[src]

Returns true if the number is divisible by 2.

pub fn is_odd(&self) -> bool[src]

Returns true if the number is not divisible by 2.

pub fn next_multiple_of(&self, other: &BigUint) -> BigUint[src]

Rounds up to nearest multiple of argument.

pub fn prev_multiple_of(&self, other: &BigUint) -> BigUint[src]

Rounds down to nearest multiple of argument.

Loading content...