[][src]Struct rug::Rational

#[repr(transparent)]pub struct Rational { /* fields omitted */ }

An arbitrary-precision rational number.

A Rational number is made up of a numerator Integer and denominator Integer. After Rational number functions, the number is always in canonical form, that is the denominator is always greater than zero, and there are no common factors. Zero is stored as 0/1.

Examples

use rug::Rational;
let r = Rational::from((-12, 15));
let recip = Rational::from(r.recip_ref());
assert_eq!(recip, (-5, 4));
assert_eq!(recip.to_f32(), -1.25);
// The numerator and denominator are stored in canonical form.
let (num, den) = r.into_numer_denom();
assert_eq!(num, -4);
assert_eq!(den, 5);

The Rational number type supports various functions. Most methods have three versions:

  1. The first method consumes the operand.
  2. The second method has a “_mut” suffix and mutates the operand.
  3. The third method has a “_ref” suffix and borrows the operand. The returned item is an incomplete-computation value that can be assigned to a Rational number.
use rug::Rational;

// 1. consume the operand
let a = Rational::from((-15, 2));
let abs_a = a.abs();
assert_eq!(abs_a, (15, 2));

// 2. mutate the operand
let mut b = Rational::from((-17, 2));
b.abs_mut();
assert_eq!(b, (17, 2));

// 3. borrow the operand
let c = Rational::from((-19, 2));
let r = c.abs_ref();
let abs_c = Rational::from(r);
assert_eq!(abs_c, (19, 2));
// c was not consumed
assert_eq!(c, (-19, 2));

Implementations

impl Rational[src]

pub fn new() -> Self[src]

Constructs a new arbitrary-precision Rational number with value 0.

Examples

use rug::Rational;
let r = Rational::new();
assert_eq!(r, 0);

pub const unsafe fn from_raw(raw: mpq_t) -> Self[src]

Creates a Rational number from an initialized GMP rational number.

Safety

  • The function must not be used to create a constant Rational number, though it can be used to create a static Rational number. This is because constant values are copied on use, leading to undefined behaviour when they are dropped.
  • The value must be initialized.
  • The mpq_t type can be considered as a kind of pointer, so there can be multiple copies of it. Since this function takes over ownership, no other copies of the passed value should exist.
  • The numerator and denominator must be in canonical form, as the rest of the library assumes that they are. Most GMP functions leave the rational number in canonical form, but assignment functions do not. Check the GMP documentation for details.

Examples

use core::mem::MaybeUninit;
use gmp_mpfr_sys::gmp;
use rug::Rational;
let r = unsafe {
    let mut q = MaybeUninit::uninit();
    gmp::mpq_init(q.as_mut_ptr());
    let mut q = q.assume_init();
    gmp::mpq_set_si(&mut q, -145, 10);
    gmp::mpq_canonicalize(&mut q);
    // q is initialized and unique
    Rational::from_raw(q)
};
assert_eq!(r, (-145, 10));
// since r is a Rational now, deallocation is automatic

This can be used to create a static Rational number using MPZ_ROINIT_N to initialize the raw numerator and denominator values. See the GMP documentation for details.

use gmp_mpfr_sys::gmp::{self, limb_t, mpq_t};
use rug::{Integer, Rational};
const NUMER_LIMBS: [limb_t; 2] = [0, 5];
const DENOM_LIMBS: [limb_t; 1] = [3];
const MPQ: mpq_t = unsafe {
    mpq_t {
        num: gmp::MPZ_ROINIT_N(NUMER_LIMBS.as_ptr() as *mut limb_t, -2),
        den: gmp::MPZ_ROINIT_N(DENOM_LIMBS.as_ptr() as *mut limb_t, 1),
    }
};
// Must *not* be const, otherwise it would lead to undefined
// behavior on use, as it would create a copy that is dropped.
static R: Rational = unsafe { Rational::from_raw(MPQ) };
let numer_check =
    -((Integer::from(NUMER_LIMBS[1]) << gmp::NUMB_BITS) + NUMER_LIMBS[0]);
let denom_check = Integer::from(DENOM_LIMBS[0]);
assert_eq!(*R.numer(), numer_check);
assert_eq!(*R.denom(), denom_check);
let check = Rational::from((&numer_check, &denom_check));
assert_eq!(R, check);
assert_eq!(*R.numer(), *check.numer());
assert_eq!(*R.denom(), *check.denom());

pub fn into_raw(self) -> mpq_t[src]

Converts a Rational number into a GMP rational number.

The returned object should be freed to avoid memory leaks.

Examples

use gmp_mpfr_sys::gmp;
use rug::Rational;
let r = Rational::from((-145, 10));
let mut q = r.into_raw();
unsafe {
    let d = gmp::mpq_get_d(&q);
    assert_eq!(d, -14.5);
    // free object to prevent memory leak
    gmp::mpq_clear(&mut q);
}

pub fn as_raw(&self) -> *const mpq_t[src]

Returns a pointer to the inner GMP rational number.

The returned pointer will be valid for as long as self is valid.

Examples

use gmp_mpfr_sys::gmp;
use rug::Rational;
let r = Rational::from((-145, 10));
let q_ptr = r.as_raw();
unsafe {
    let d = gmp::mpq_get_d(q_ptr);
    assert_eq!(d, -14.5);
}
// r is still valid
assert_eq!(r, (-145, 10));

pub fn as_raw_mut(&mut self) -> *mut mpq_t[src]

Returns an unsafe mutable pointer to the inner GMP rational number.

The returned pointer will be valid for as long as self is valid.

Examples

use gmp_mpfr_sys::gmp;
use rug::Rational;
let mut r = Rational::from((-145, 10));
let q_ptr = r.as_raw_mut();
unsafe {
    gmp::mpq_inv(q_ptr, q_ptr);
}
assert_eq!(r, (-10, 145));

pub fn from_f32(value: f32) -> Option<Self>[src]

Creates a Rational number from an f32 if it is finite, losing no precision.

This conversion can also be performed using

Examples

use core::f32;
use rug::Rational;
// −17.125 can be stored exactly as f32
let r = Rational::from_f32(-17.125).unwrap();
assert_eq!(r, (-17125, 1000));
let inf = Rational::from_f32(f32::INFINITY);
assert!(inf.is_none());

pub fn from_f64(value: f64) -> Option<Self>[src]

Creates a Rational number from an f64 if it is finite, losing no precision.

This conversion can also be performed using

Examples

use core::f64;
use rug::Rational;
// −17.125 can be stored exactly as f64
let r = Rational::from_f64(-17.125).unwrap();
assert_eq!(r, (-17125, 1000));
let inf = Rational::from_f64(f64::INFINITY);
assert!(inf.is_none());

pub fn from_str_radix(src: &str, radix: i32) -> Result<Self, ParseRationalError>[src]

Parses a Rational number.

Panics

Panics if radix is less than 2 or greater than 36.

Examples

use rug::Rational;
let r1 = Rational::from_str_radix("ff/a", 16).unwrap();
assert_eq!(r1, (255, 10));
let r2 = Rational::from_str_radix("+ff0/a0", 16).unwrap();
assert_eq!(r2, (0xff0, 0xa0));
assert_eq!(*r2.numer(), 51);
assert_eq!(*r2.denom(), 2);

pub fn parse<S: AsRef<[u8]>>(
    src: S
) -> Result<ParseIncomplete, ParseRationalError>
[src]

Parses a decimal string slice (&str) or byte slice (&[u8]) into a Rational number.

The following are implemented with the unwrapped returned incomplete-computation value as Src:

The string must contain a numerator, and may contain a denominator; the numerator and denominator are separated with a “/”. The numerator can start with an optional minus or plus sign.

ASCII whitespace is ignored everywhere in the string. Underscores are ignored anywhere except before the first digit of the numerator and between the “/” and the the first digit of the denominator.

Examples

use rug::Rational;

let valid1 = Rational::parse("-12/23");
let r1 = Rational::from(valid1.unwrap());
assert_eq!(r1, (-12, 23));
let valid2 = Rational::parse("+ 12 / 23");
let r2 = Rational::from(valid2.unwrap());
assert_eq!(r2, (12, 23));

let invalid = Rational::parse("12/");
assert!(invalid.is_err());

pub fn parse_radix<S: AsRef<[u8]>>(
    src: S,
    radix: i32
) -> Result<ParseIncomplete, ParseRationalError>
[src]

Parses a string slice (&str) or byte slice (&[u8]) into a Rational number.

The following are implemented with the unwrapped returned incomplete-computation value as Src:

The string must contain a numerator, and may contain a denominator; the numerator and denominator are separated with a “/”. The numerator can start with an optional minus or plus sign.

ASCII whitespace is ignored everywhere in the string. Underscores are ignored anywhere except before the first digit of the numerator and between the “/” and the the first digit of the denominator.

Panics

Panics if radix is less than 2 or greater than 36.

Examples

use rug::Rational;

let valid1 = Rational::parse_radix("12/23", 4);
let r1 = Rational::from(valid1.unwrap());
assert_eq!(r1, (2 + 4 * 1, 3 + 4 * 2));
let valid2 = Rational::parse_radix("12 / yz", 36);
let r2 = Rational::from(valid2.unwrap());
assert_eq!(r2, (2 + 36 * 1, 35 + 36 * 34));

let invalid = Rational::parse_radix("12/", 10);
assert!(invalid.is_err());

pub fn to_f32(&self) -> f32[src]

Converts to an f32, rounding towards zero.

This conversion can also be performed using

Examples

use core::f32;
use rug::{rational::SmallRational, Rational};
let min = Rational::from_f32(f32::MIN).unwrap();
let minus_small = min - &*SmallRational::from((7, 2));
// minus_small is truncated to f32::MIN
assert_eq!(minus_small.to_f32(), f32::MIN);
let times_three_two = minus_small * &*SmallRational::from((3, 2));
// times_three_two is too small
assert_eq!(times_three_two.to_f32(), f32::NEG_INFINITY);

pub fn to_f64(&self) -> f64[src]

Converts to an f64, rounding towards zero.

This conversion can also be performed using

Examples

use core::f64;
use rug::{rational::SmallRational, Rational};

// An `f64` has 53 bits of precision.
let exact = 0x1f_1234_5678_9aff_u64;
let den = 0x1000_u64;
let r = Rational::from((exact, den));
assert_eq!(r.to_f64(), exact as f64 / den as f64);

// large has 56 ones
let large = 0xff_1234_5678_9aff_u64;
// trunc has 53 ones followed by 3 zeros
let trunc = 0xff_1234_5678_9af8_u64;
let j = Rational::from((large, den));
assert_eq!(j.to_f64(), trunc as f64 / den as f64);

let max = Rational::from_f64(f64::MAX).unwrap();
let plus_small = max + &*SmallRational::from((7, 2));
// plus_small is truncated to f64::MAX
assert_eq!(plus_small.to_f64(), f64::MAX);
let times_three_two = plus_small * &*SmallRational::from((3, 2));
// times_three_two is too large
assert_eq!(times_three_two.to_f64(), f64::INFINITY);

pub fn to_string_radix(&self, radix: i32) -> String[src]

Returns a string representation for the specified radix.

Panics

Panics if radix is less than 2 or greater than 36.

Examples

use rug::Rational;
let r1 = Rational::from(0);
assert_eq!(r1.to_string_radix(10), "0");
let r2 = Rational::from((15, 5));
assert_eq!(r2.to_string_radix(10), "3");
let r3 = Rational::from((10, -6));
assert_eq!(r3.to_string_radix(10), "-5/3");
assert_eq!(r3.to_string_radix(5), "-10/3");

pub fn assign_f32(&mut self, val: f32) -> Result<(), ()>[src]

Assigns from an f32 if it is finite, losing no precision.

Examples

use core::f32;
use rug::Rational;
let mut r = Rational::new();
let ret = r.assign_f32(12.75);
assert!(ret.is_ok());
assert_eq!(r, (1275, 100));
let ret = r.assign_f32(f32::NAN);
assert!(ret.is_err());
assert_eq!(r, (1275, 100));

pub fn assign_f64(&mut self, val: f64) -> Result<(), ()>[src]

Assigns from an f64 if it is finite, losing no precision.

Examples

use rug::Rational;
let mut r = Rational::new();
let ret = r.assign_f64(12.75);
assert!(ret.is_ok());
assert_eq!(r, (1275, 100));
let ret = r.assign_f64(1.0 / 0.0);
assert!(ret.is_err());
assert_eq!(r, (1275, 100));

pub unsafe fn from_canonical<Num, Den>(num: Num, den: Den) -> Self where
    Integer: From<Num> + From<Den>, 
[src]

Creates a new Rational number from a numerator and denominator without canonicalizing aftwerwards.

Safety

This function is unsafe because it does not canonicalize the Rational number. The caller must ensure that the numerator and denominator are in canonical form, as the rest of the library assumes that they are.

Examples

use rug::Rational;

// −3/5 is in canonical form
let r = unsafe { Rational::from_canonical(-3, 5) };
assert_eq!(r, (-3, 5));

pub unsafe fn assign_canonical<Num, Den>(&mut self, num: Num, den: Den) where
    Integer: Assign<Num> + Assign<Den>, 
[src]

Assigns to the numerator and denominator without canonicalizing aftwerwards.

Safety

This function is unsafe because it does not canonicalize the Rational number after the assignment. The caller must ensure that the numerator and denominator are in canonical form, as the rest of the library assumes that they are.

Examples

use rug::Rational;

let mut r = Rational::new();
// −3/5 is in canonical form
unsafe {
    r.assign_canonical(-3, 5);
}
assert_eq!(r, (-3, 5));

pub fn numer(&self) -> &Integer[src]

Borrows the numerator as an Integer.

Examples

use rug::Rational;
let r = Rational::from((12, -20));
// r will be canonicalized to −3/5
assert_eq!(*r.numer(), -3)

pub fn denom(&self) -> &Integer[src]

Borrows the denominator as an Integer.

Examples

use rug::Rational;
let r = Rational::from((12, -20));
// r will be canonicalized to −3/5
assert_eq!(*r.denom(), 5);

pub fn mutate_numer_denom<F>(&mut self, func: F) where
    F: FnOnce(&mut Integer, &mut Integer), 
[src]

Calls a function with mutable references to the numerator and denominator, then canonicalizes the number.

The denominator must not be zero when the function returns.

Panics

Panics if the denominator is zero when the function returns.

Examples

use rug::Rational;
let mut r = Rational::from((3, 5));
r.mutate_numer_denom(|num, den| {
    // change r from 3/5 to 4/8, which is equal to 1/2
    *num += 1;
    *den += 3;
});
assert_eq!(*r.numer(), 1);
assert_eq!(*r.denom(), 2);

This method does not check that the numerator and denominator are in canonical form before calling func. This means that this method can be used to canonicalize the number after some unsafe methods that do not leave the number in cononical form.

use rug::Rational;
let mut r = Rational::from((3, 5));
unsafe {
    // leave r in non-canonical form
    *r.as_mut_numer_denom_no_canonicalization().0 += 1;
    *r.as_mut_numer_denom_no_canonicalization().1 -= 13;
}
// At this point, r is still not canonical: 4 / −8
assert_eq!(*r.numer(), 4);
assert_eq!(*r.denom(), -8);
r.mutate_numer_denom(|_, _| {});
// Now r is in canonical form: −1 / 2
assert_eq!(*r.numer(), -1);
assert_eq!(*r.denom(), 2);

pub unsafe fn as_mut_numer_denom_no_canonicalization(
    &mut self
) -> (&mut Integer, &mut Integer)
[src]

Borrows the numerator and denominator mutably without canonicalizing aftwerwards.

Safety

This function is unsafe because it does not canonicalize the Rational number when the borrow ends. The caller must ensure that the numerator and denominator are left in canonical form, as the rest of the library assumes that they are.

Examples

use rug::Rational;

let mut r = Rational::from((3, 5));
{
    let (num, den) = unsafe { r.as_mut_numer_denom_no_canonicalization() };
    // Add one to r by adding den to num. Since num and den
    // are relatively prime, r remains in canonical form.
    *num += &*den;
}
assert_eq!(r, (8, 5));

This method can also be used to group some operations before canonicalization. This is usually not beneficial, as early canonicalization usually means subsequent arithmetic operations have less work to do.

use rug::Rational;
let mut r = Rational::from((3, 5));
unsafe {
    // first operation: add 1 to numerator
    *r.as_mut_numer_denom_no_canonicalization().0 += 1;
    // second operation: subtract 13 from denominator
    *r.as_mut_numer_denom_no_canonicalization().1 -= 13;
}
// At this point, r is still not canonical: 4 / −8
assert_eq!(*r.numer(), 4);
assert_eq!(*r.denom(), -8);
r.mutate_numer_denom(|_, _| {});
// Now r is in canonical form: −1 / 2
assert_eq!(*r.numer(), -1);
assert_eq!(*r.denom(), 2);

pub fn into_numer_denom(self) -> (Integer, Integer)[src]

Converts into numerator and denominator Integer values.

This function reuses the allocated memory and does not allocate any new memory.

Examples

use rug::Rational;
let r = Rational::from((12, -20));
// r will be canonicalized to −3/5
let (num, den) = r.into_numer_denom();
assert_eq!(num, -3);
assert_eq!(den, 5);

pub fn as_neg(&self) -> BorrowRational[src]

Borrows a negated copy of the Rational number.

The returned object implements Deref<Target = Rational>.

This method performs a shallow copy and negates it, and negation does not change the allocated data.

Examples

use rug::Rational;
let r = Rational::from((7, 11));
let neg_r = r.as_neg();
assert_eq!(*neg_r, (-7, 11));
// methods taking &self can be used on the returned object
let reneg_r = neg_r.as_neg();
assert_eq!(*reneg_r, (7, 11));
assert_eq!(*reneg_r, r);

pub fn as_abs(&self) -> BorrowRational[src]

Borrows an absolute copy of the Rational number.

The returned object implements Deref<Target = Rational>.

This method performs a shallow copy and possibly negates it, and negation does not change the allocated data.

Examples

use rug::Rational;
let r = Rational::from((-7, 11));
let abs_r = r.as_abs();
assert_eq!(*abs_r, (7, 11));
// methods taking &self can be used on the returned object
let reabs_r = abs_r.as_abs();
assert_eq!(*reabs_r, (7, 11));
assert_eq!(*reabs_r, *abs_r);

pub fn as_recip(&self) -> BorrowRational[src]

Borrows a reciprocal copy of the Rational number.

The returned object implements Deref<Target = Rational>.

This method performs some shallow copying, swapping numerator and denominator and making sure the sign is in the numerator.

Panics

Panics if the value is zero.

Examples

use rug::Rational;
let r = Rational::from((-7, 11));
let recip_r = r.as_recip();
assert_eq!(*recip_r, (-11, 7));
// methods taking &self can be used on the returned object
let rerecip_r = recip_r.as_recip();
assert_eq!(*rerecip_r, (-7, 11));
assert_eq!(*rerecip_r, r);

pub fn cmp0(&self) -> Ordering[src]

Returns the same result as self.cmp(&0.into()), but is faster.

Examples

use core::cmp::Ordering;
use rug::Rational;
assert_eq!(Rational::from((-5, 7)).cmp0(), Ordering::Less);
assert_eq!(Rational::from(0).cmp0(), Ordering::Equal);
assert_eq!(Rational::from((5, 7)).cmp0(), Ordering::Greater);

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

Compares the absolute values.

Examples

use core::cmp::Ordering;
use rug::Rational;
let a = Rational::from((-23, 10));
let b = Rational::from((-47, 5));
assert_eq!(a.cmp(&b), Ordering::Greater);
assert_eq!(a.cmp_abs(&b), Ordering::Less);

pub fn sum<'a, I>(values: I) -> SumIncomplete<'a, I> where
    I: Iterator<Item = &'a Self>, 
[src]

Adds a list of Rational values.

The following are implemented with the returned incomplete-computation value as Src:

Examples

use rug::Rational;

let values = [
    Rational::from((5, 2)),
    Rational::from((-100_000, 7)),
    Rational::from(-4),
];

let r = Rational::sum(values.iter());
let sum = Rational::from(r);
let expected = (5 * 7 - 100_000 * 2 - 4 * 14, 14);
assert_eq!(sum, expected);

pub fn dot<'a, I>(values: I) -> DotIncomplete<'a, I> where
    I: Iterator<Item = (&'a Self, &'a Self)>, 
[src]

Finds the dot product of a list of Rational value pairs.

The following are implemented with the returned incomplete-computation value as Src:

Examples

use rug::Rational;

let a = [Rational::from((270, 7)), Rational::from((-11, 10))];
let b = [Rational::from(7), Rational::from((1, 2))];

let r = Rational::dot(a.iter().zip(b.iter()));
let dot = Rational::from(r);
let expected = (270 * 20 - 11, 20);
assert_eq!(dot, expected);

pub fn product<'a, I>(values: I) -> ProductIncomplete<'a, I> where
    I: Iterator<Item = &'a Self>, 
[src]

Multiplies a list of Rational values.

The following are implemented with the returned incomplete-computation value as Src:

Examples

use rug::Rational;

let values = [
    Rational::from((5, 2)),
    Rational::from((-100_000, 7)),
    Rational::from(-4),
];

let r = Rational::product(values.iter());
let product = Rational::from(r);
let expected = (5 * -100_000 * -4, 2 * 7);
assert_eq!(product, expected);

pub fn abs(self) -> Self[src]

Computes the absolute value.

Examples

use rug::Rational;
let r = Rational::from((-100, 17));
let abs = r.abs();
assert_eq!(abs, (100, 17));

pub fn abs_mut(&mut self)[src]

Computes the absolute value.

Examples

use rug::Rational;
let mut r = Rational::from((-100, 17));
r.abs_mut();
assert_eq!(r, (100, 17));

pub fn abs_ref(&self) -> AbsIncomplete[src]

Computes the absolute value.

The following are implemented with the returned incomplete-computation value as Src:

Examples

use rug::Rational;
let r = Rational::from((-100, 17));
let r_ref = r.abs_ref();
let abs = Rational::from(r_ref);
assert_eq!(abs, (100, 17));

pub fn signum(self) -> Rational[src]

Computes the signum.

  • 0 if the value is zero
  • 1 if the value is positive
  • −1 if the value is negative

Examples

use rug::Rational;
let r = Rational::from((-100, 17));
let signum = r.signum();
assert_eq!(signum, -1);

pub fn signum_mut(&mut self)[src]

Computes the signum.

  • 0 if the value is zero
  • 1 if the value is positive
  • −1 if the value is negative

Examples

use rug::Rational;
let mut r = Rational::from((-100, 17));
r.signum_mut();
assert_eq!(r, -1);

pub fn signum_ref(&self) -> SignumIncomplete[src]

Computes the signum.

  • 0 if the value is zero
  • 1 if the value is positive
  • −1 if the value is negative

The following are implemented with the returned incomplete-computation value as Src:

Examples

use rug::{Integer, Rational};
let r = Rational::from((-100, 17));
let r_ref = r.signum_ref();
let signum = Integer::from(r_ref);
assert_eq!(signum, -1);

pub fn clamp<Min, Max>(self, min: &Min, max: &Max) -> Self where
    Self: PartialOrd<Min> + PartialOrd<Max> + for<'a> Assign<&'a Min> + for<'a> Assign<&'a Max>, 
[src]

Clamps the value within the specified bounds.

Panics

Panics if the maximum value is less than the minimum value.

Examples

use rug::Rational;
let min = (-3, 2);
let max = (3, 2);
let too_small = Rational::from((-5, 2));
let clamped1 = too_small.clamp(&min, &max);
assert_eq!(clamped1, (-3, 2));
let in_range = Rational::from((1, 2));
let clamped2 = in_range.clamp(&min, &max);
assert_eq!(clamped2, (1, 2));

pub fn clamp_mut<Min, Max>(&mut self, min: &Min, max: &Max) where
    Self: PartialOrd<Min> + PartialOrd<Max> + for<'a> Assign<&'a Min> + for<'a> Assign<&'a Max>, 
[src]

Clamps the value within the specified bounds.

Panics

Panics if the maximum value is less than the minimum value.

Examples

use rug::Rational;
let min = (-3, 2);
let max = (3, 2);
let mut too_small = Rational::from((-5, 2));
too_small.clamp_mut(&min, &max);
assert_eq!(too_small, (-3, 2));
let mut in_range = Rational::from((1, 2));
in_range.clamp_mut(&min, &max);
assert_eq!(in_range, (1, 2));

pub fn clamp_ref<'min, 'max, Min, Max>(
    &self,
    min: &'min Min,
    max: &'max Max
) -> ClampIncomplete<'_, 'min, 'max, Min, Max> where
    Self: PartialOrd<Min> + PartialOrd<Max> + for<'a> Assign<&'a Min> + for<'a> Assign<&'a Max>, 
[src]

Clamps the value within the specified bounds.

The following are implemented with the returned incomplete-computation value as Src:

Panics

Panics if the maximum value is less than the minimum value.

Examples

use rug::Rational;
let min = (-3, 2);
let max = (3, 2);
let too_small = Rational::from((-5, 2));
let r1 = too_small.clamp_ref(&min, &max);
let clamped1 = Rational::from(r1);
assert_eq!(clamped1, (-3, 2));
let in_range = Rational::from((1, 2));
let r2 = in_range.clamp_ref(&min, &max);
let clamped2 = Rational::from(r2);
assert_eq!(clamped2, (1, 2));

pub fn recip(self) -> Self[src]

Computes the reciprocal.

Panics

Panics if the value is zero.

Examples

use rug::Rational;
let r = Rational::from((-100, 17));
let recip = r.recip();
assert_eq!(recip, (-17, 100));

pub fn recip_mut(&mut self)[src]

Computes the reciprocal.

This method never reallocates or copies the heap data. It simply swaps the allocated data of the numerator and denominator and makes sure the denominator is stored as positive.

Panics

Panics if the value is zero.

Examples

use rug::Rational;
let mut r = Rational::from((-100, 17));
r.recip_mut();
assert_eq!(r, (-17, 100));

pub fn recip_ref(&self) -> RecipIncomplete[src]

Computes the reciprocal.

The following are implemented with the returned incomplete-computation value as Src:

Examples

use rug::Rational;
let r = Rational::from((-100, 17));
let r_ref = r.recip_ref();
let recip = Rational::from(r_ref);
assert_eq!(recip, (-17, 100));

pub fn trunc(self) -> Rational[src]

Rounds the number towards zero.

Examples

use rug::Rational;
// −3.7
let r1 = Rational::from((-37, 10));
let trunc1 = r1.trunc();
assert_eq!(trunc1, -3);
// 3.3
let r2 = Rational::from((33, 10));
let trunc2 = r2.trunc();
assert_eq!(trunc2, 3);

pub fn trunc_mut(&mut self)[src]

Rounds the number towards zero.

Examples

use rug::{Assign, Rational};
// −3.7
let mut r = Rational::from((-37, 10));
r.trunc_mut();
assert_eq!(r, -3);
// 3.3
r.assign((33, 10));
r.trunc_mut();
assert_eq!(r, 3);

pub fn trunc_ref(&self) -> TruncIncomplete[src]

Rounds the number towards zero.

The following are implemented with the returned incomplete-computation value as Src:

Examples

use rug::{Assign, Integer, Rational};
let mut trunc = Integer::new();
// −3.7
let r1 = Rational::from((-37, 10));
trunc.assign(r1.trunc_ref());
assert_eq!(trunc, -3);
// 3.3
let r2 = Rational::from((33, 10));
trunc.assign(r2.trunc_ref());
assert_eq!(trunc, 3);

pub fn rem_trunc(self) -> Self[src]

Computes the fractional part of the number.

Examples

use rug::Rational;
// −100/17 = −5 − 15/17
let r = Rational::from((-100, 17));
let rem = r.rem_trunc();
assert_eq!(rem, (-15, 17));

pub fn rem_trunc_mut(&mut self)[src]

Computes the fractional part of the number.

Examples

use rug::Rational;
// −100/17 = −5 − 15/17
let mut r = Rational::from((-100, 17));
r.rem_trunc_mut();
assert_eq!(r, (-15, 17));

pub fn rem_trunc_ref(&self) -> RemTruncIncomplete[src]

Computes the fractional part of the number.

The following are implemented with the returned incomplete-computation value as Src:

Examples

use rug::Rational;
// −100/17 = −5 − 15/17
let r = Rational::from((-100, 17));
let r_ref = r.rem_trunc_ref();
let rem = Rational::from(r_ref);
assert_eq!(rem, (-15, 17));

pub fn fract_trunc(self, trunc: Integer) -> (Self, Integer)[src]

Computes the fractional and truncated parts of the number.

The initial value of trunc is ignored.

Examples

use rug::{Integer, Rational};
// −100/17 = −5 − 15/17
let r = Rational::from((-100, 17));
let (fract, trunc) = r.fract_trunc(Integer::new());
assert_eq!(fract, (-15, 17));
assert_eq!(trunc, -5);

pub fn fract_trunc_mut(&mut self, trunc: &mut Integer)[src]

Computes the fractional and truncated parts of the number.

The initial value of trunc is ignored.

Examples

use rug::{Integer, Rational};
// −100/17 = −5 − 15/17
let mut r = Rational::from((-100, 17));
let mut whole = Integer::new();
r.fract_trunc_mut(&mut whole);
assert_eq!(r, (-15, 17));
assert_eq!(whole, -5);

pub fn fract_trunc_ref(&self) -> FractTruncIncomplete[src]

Computes the fractional and truncated parts of the number.

The following are implemented with the returned incomplete-computation value as Src:

Examples

use rug::{Assign, Integer, Rational};
// −100/17 = −5 − 15/17
let r = Rational::from((-100, 17));
let r_ref = r.fract_trunc_ref();
let (mut fract, mut trunc) = (Rational::new(), Integer::new());
(&mut fract, &mut trunc).assign(r_ref);
assert_eq!(fract, (-15, 17));
assert_eq!(trunc, -5);

pub fn ceil(self) -> Rational[src]

Rounds the number upwards (towards plus infinity).

Examples

use rug::Rational;
// −3.7
let r1 = Rational::from((-37, 10));
let ceil1 = r1.ceil();
assert_eq!(ceil1, -3);
// 3.3
let r2 = Rational::from((33, 10));
let ceil2 = r2.ceil();
assert_eq!(ceil2, 4);

pub fn ceil_mut(&mut self)[src]

Rounds the number upwards (towards plus infinity).

Examples

use rug::{Assign, Rational};
// −3.7
let mut r = Rational::from((-37, 10));
r.ceil_mut();
assert_eq!(r, -3);
// 3.3
r.assign((33, 10));
r.ceil_mut();
assert_eq!(r, 4);

pub fn ceil_ref(&self) -> CeilIncomplete[src]

Rounds the number upwards (towards plus infinity).

The following are implemented with the returned incomplete-computation value as Src:

Examples

use rug::{Assign, Integer, Rational};
let mut ceil = Integer::new();
// −3.7
let r1 = Rational::from((-37, 10));
ceil.assign(r1.ceil_ref());
assert_eq!(ceil, -3);
// 3.3
let r2 = Rational::from((33, 10));
ceil.assign(r2.ceil_ref());
assert_eq!(ceil, 4);

pub fn rem_ceil(self) -> Self[src]

Computes the non-positive remainder after rounding up.

Examples

use rug::Rational;
// 100/17 = 6 − 2/17
let r = Rational::from((100, 17));
let rem = r.rem_ceil();
assert_eq!(rem, (-2, 17));

pub fn rem_ceil_mut(&mut self)[src]

Computes the non-positive remainder after rounding up.

Examples

use rug::Rational;
// 100/17 = 6 − 2/17
let mut r = Rational::from((100, 17));
r.rem_ceil_mut();
assert_eq!(r, (-2, 17));

pub fn rem_ceil_ref(&self) -> RemCeilIncomplete[src]

Computes the non-positive remainder after rounding up.

The following are implemented with the returned incomplete-computation value as Src:

Examples

use rug::Rational;
// 100/17 = 6 − 2/17
let r = Rational::from((100, 17));
let r_ref = r.rem_ceil_ref();
let rem = Rational::from(r_ref);
assert_eq!(rem, (-2, 17));

pub fn fract_ceil(self, ceil: Integer) -> (Self, Integer)[src]

Computes the fractional and ceil parts of the number.

The fractional part cannot greater than zero.

The initial value of ceil is ignored.

Examples

use rug::{Integer, Rational};
// 100/17 = 6 − 2/17
let r = Rational::from((100, 17));
let (fract, ceil) = r.fract_ceil(Integer::new());
assert_eq!(fract, (-2, 17));
assert_eq!(ceil, 6);

pub fn fract_ceil_mut(&mut self, ceil: &mut Integer)[src]

Computes the fractional and ceil parts of the number.

The fractional part cannot be greater than zero.

The initial value of ceil is ignored.

Examples

use rug::{Integer, Rational};
// 100/17 = 6 − 2/17
let mut r = Rational::from((100, 17));
let mut ceil = Integer::new();
r.fract_ceil_mut(&mut ceil);
assert_eq!(r, (-2, 17));
assert_eq!(ceil, 6);

pub fn fract_ceil_ref(&self) -> FractCeilIncomplete[src]

Computes the fractional and ceil parts of the number.

The fractional part cannot be greater than zero.

The following are implemented with the returned incomplete-computation value as Src:

Examples

use rug::{Assign, Integer, Rational};
// 100/17 = 6 − 2/17
let r = Rational::from((100, 17));
let r_ref = r.fract_ceil_ref();
let (mut fract, mut ceil) = (Rational::new(), Integer::new());
(&mut fract, &mut ceil).assign(r_ref);
assert_eq!(fract, (-2, 17));
assert_eq!(ceil, 6);

pub fn floor(self) -> Rational[src]

Rounds the number downwards (towards minus infinity).

Examples

use rug::Rational;
// −3.7
let r1 = Rational::from((-37, 10));
let floor1 = r1.floor();
assert_eq!(floor1, -4);
// 3.3
let r2 = Rational::from((33, 10));
let floor2 = r2.floor();
assert_eq!(floor2, 3);

pub fn floor_mut(&mut self)[src]

Rounds the number downwards (towards minus infinity).

use rug::{Assign, Rational};
// −3.7
let mut r = Rational::from((-37, 10));
r.floor_mut();
assert_eq!(r, -4);
// 3.3
r.assign((33, 10));
r.floor_mut();
assert_eq!(r, 3);

pub fn floor_ref(&self) -> FloorIncomplete[src]

Rounds the number downwards (towards minus infinity).

The following are implemented with the returned incomplete-computation value as Src:

Examples

use rug::{Assign, Integer, Rational};
let mut floor = Integer::new();
// −3.7
let r1 = Rational::from((-37, 10));
floor.assign(r1.floor_ref());
assert_eq!(floor, -4);
// 3.3
let r2 = Rational::from((33, 10));
floor.assign(r2.floor_ref());
assert_eq!(floor, 3);

pub fn rem_floor(self) -> Self[src]

Computes the non-negative remainder after rounding down.

Examples

use rug::Rational;
// −100/17 = −6 + 2/17
let r = Rational::from((-100, 17));
let rem = r.rem_floor();
assert_eq!(rem, (2, 17));

pub fn rem_floor_mut(&mut self)[src]

Computes the non-negative remainder after rounding down.

Examples

use rug::Rational;
// −100/17 = −6 + 2/17
let mut r = Rational::from((-100, 17));
r.rem_floor_mut();
assert_eq!(r, (2, 17));

pub fn rem_floor_ref(&self) -> RemFloorIncomplete[src]

Computes the non-negative remainder after rounding down.

The following are implemented with the returned incomplete-computation value as Src:

Examples

use rug::Rational;
// −100/17 = −6 + 2/17
let r = Rational::from((-100, 17));
let r_ref = r.rem_floor_ref();
let rem = Rational::from(r_ref);
assert_eq!(rem, (2, 17));

pub fn fract_floor(self, floor: Integer) -> (Self, Integer)[src]

Computes the fractional and floor parts of the number.

The fractional part cannot be negative.

The initial value of floor is ignored.

Examples

use rug::{Integer, Rational};
// −100/17 = −6 + 2/17
let r = Rational::from((-100, 17));
let (fract, floor) = r.fract_floor(Integer::new());
assert_eq!(fract, (2, 17));
assert_eq!(floor, -6);

pub fn fract_floor_mut(&mut self, floor: &mut Integer)[src]

Computes the fractional and floor parts of the number.

The fractional part cannot be negative.

The initial value of floor is ignored.

Examples

use rug::{Integer, Rational};
// −100/17 = −6 + 2/17
let mut r = Rational::from((-100, 17));
let mut floor = Integer::new();
r.fract_floor_mut(&mut floor);
assert_eq!(r, (2, 17));
assert_eq!(floor, -6);

pub fn fract_floor_ref(&self) -> FractFloorIncomplete[src]

Computes the fractional and floor parts of the number.

The fractional part cannot be negative.

The following are implemented with the returned incomplete-computation value as Src:

Examples

use rug::{Assign, Integer, Rational};
// −100/17 = −6 + 2/17
let r = Rational::from((-100, 17));
let r_ref = r.fract_floor_ref();
let (mut fract, mut floor) = (Rational::new(), Integer::new());
(&mut fract, &mut floor).assign(r_ref);
assert_eq!(fract, (2, 17));
assert_eq!(floor, -6);

pub fn round(self) -> Rational[src]

Rounds the number to the nearest integer.

When the number lies exactly between two integers, it is rounded away from zero.

Examples

use rug::Rational;
// −3.5
let r1 = Rational::from((-35, 10));
let round1 = r1.round();
assert_eq!(round1, -4);
// 3.7
let r2 = Rational::from((37, 10));
let round2 = r2.round();
assert_eq!(round2, 4);

pub fn round_mut(&mut self)[src]

Rounds the number to the nearest integer.

When the number lies exactly between two integers, it is rounded away from zero.

Examples

use rug::{Assign, Rational};
// −3.5
let mut r = Rational::from((-35, 10));
r.round_mut();
assert_eq!(r, -4);
// 3.7
r.assign((37, 10));
r.round_mut();
assert_eq!(r, 4);

pub fn round_ref(&self) -> RoundIncomplete[src]

Rounds the number to the nearest integer.

When the number lies exactly between two integers, it is rounded away from zero.

The following are implemented with the returned incomplete-computation value as Src:

Examples

use rug::{Assign, Integer, Rational};
let mut round = Integer::new();
// −3.5
let r1 = Rational::from((-35, 10));
round.assign(r1.round_ref());
assert_eq!(round, -4);
// 3.7
let r2 = Rational::from((37, 10));
round.assign(r2.round_ref());
assert_eq!(round, 4);

pub fn rem_round(self) -> Self[src]

Computes the remainder after rounding to the nearest integer.

Examples

use rug::Rational;
// −3.5 = −4 + 0.5 = −4 + 1/2
let r1 = Rational::from((-35, 10));
let rem1 = r1.rem_round();
assert_eq!(rem1, (1, 2));
// 3.7 = 4 − 0.3 = 4 − 3/10
let r2 = Rational::from((37, 10));
let rem2 = r2.rem_round();
assert_eq!(rem2, (-3, 10));

pub fn rem_round_mut(&mut self)[src]

Computes the remainder after rounding to the nearest integer.

Examples

use rug::Rational;
// −3.5 = −4 + 0.5 = −4 + 1/2
let mut r1 = Rational::from((-35, 10));
r1.rem_round_mut();
assert_eq!(r1, (1, 2));
// 3.7 = 4 − 0.3 = 4 − 3/10
let mut r2 = Rational::from((37, 10));
r2.rem_round_mut();
assert_eq!(r2, (-3, 10));

pub fn rem_round_ref(&self) -> RemRoundIncomplete[src]

Computes the remainder after rounding to the nearest integer.

The following are implemented with the returned incomplete-computation value as Src:

Examples

use rug::Rational;
// −3.5 = −4 + 0.5 = −4 + 1/2
let r1 = Rational::from((-35, 10));
let r_ref1 = r1.rem_round_ref();
let rem1 = Rational::from(r_ref1);
assert_eq!(rem1, (1, 2));
// 3.7 = 4 − 0.3 = 4 − 3/10
let r2 = Rational::from((37, 10));
let r_ref2 = r2.rem_round_ref();
let rem2 = Rational::from(r_ref2);
assert_eq!(rem2, (-3, 10));

pub fn fract_round(self, round: Integer) -> (Self, Integer)[src]

Computes the fractional and rounded parts of the number.

The fractional part is positive when the number is rounded down and negative when the number is rounded up. When the number lies exactly between two integers, it is rounded away from zero.

The initial value of round is ignored.

Examples

use rug::{Integer, Rational};
// −3.5 = −4 + 0.5 = −4 + 1/2
let r1 = Rational::from((-35, 10));
let (fract1, round1) = r1.fract_round(Integer::new());
assert_eq!(fract1, (1, 2));
assert_eq!(round1, -4);
// 3.7 = 4 − 0.3 = 4 − 3/10
let r2 = Rational::from((37, 10));
let (fract2, round2) = r2.fract_round(Integer::new());
assert_eq!(fract2, (-3, 10));
assert_eq!(round2, 4);

pub fn fract_round_mut(&mut self, round: &mut Integer)[src]

Computes the fractional and round parts of the number.

The fractional part is positive when the number is rounded down and negative when the number is rounded up. When the number lies exactly between two integers, it is rounded away from zero.

The initial value of round is ignored.

Examples

use rug::{Integer, Rational};
// −3.5 = −4 + 0.5 = −4 + 1/2
let mut r1 = Rational::from((-35, 10));
let mut round1 = Integer::new();
r1.fract_round_mut(&mut round1);
assert_eq!(r1, (1, 2));
assert_eq!(round1, -4);
// 3.7 = 4 − 0.3 = 4 − 3/10
let mut r2 = Rational::from((37, 10));
let mut round2 = Integer::new();
r2.fract_round_mut(&mut round2);
assert_eq!(r2, (-3, 10));
assert_eq!(round2, 4);

pub fn fract_round_ref(&self) -> FractRoundIncomplete[src]

Computes the fractional and round parts of the number.

The fractional part is positive when the number is rounded down and negative when the number is rounded up. When the number lies exactly between two integers, it is rounded away from zero.

The following are implemented with the returned incomplete-computation value as Src:

Examples

use rug::{Assign, Integer, Rational};
// −3.5 = −4 + 0.5 = −4 + 1/2
let r1 = Rational::from((-35, 10));
let r_ref1 = r1.fract_round_ref();
let (mut fract1, mut round1) = (Rational::new(), Integer::new());
(&mut fract1, &mut round1).assign(r_ref1);
assert_eq!(fract1, (1, 2));
assert_eq!(round1, -4);
// 3.7 = 4 − 0.3 = 4 − 3/10
let r2 = Rational::from((37, 10));
let r_ref2 = r2.fract_round_ref();
let (mut fract2, mut round2) = (Rational::new(), Integer::new());
(&mut fract2, &mut round2).assign(r_ref2);
assert_eq!(fract2, (-3, 10));
assert_eq!(round2, 4);

pub fn square(self) -> Self[src]

Computes the square.

Examples

use rug::Rational;
let r = Rational::from((-13, 2));
let square = r.square();
assert_eq!(square, (169, 4));

pub fn square_mut(&mut self)[src]

Computes the square.

Examples

use rug::Rational;
let mut r = Rational::from((-13, 2));
r.square_mut();
assert_eq!(r, (169, 4));

pub fn square_ref(&self) -> SquareIncomplete[src]

Computes the square.

The following are implemented with the returned incomplete-computation value as Src:

Examples

use rug::Rational;
let r = Rational::from((-13, 2));
assert_eq!(Rational::from(r.square_ref()), (169, 4));

Trait Implementations

impl<'_> Add<&'_ Integer> for Rational[src]

type Output = Rational

The resulting type after applying the + operator.

impl<'_> Add<&'_ Rational> for Rational[src]

type Output = Rational

The resulting type after applying the + operator.

impl<'_> Add<&'_ Rational> for Float[src]

type Output = Float

The resulting type after applying the + operator.

impl<'_> Add<&'_ Rational> for Complex[src]

type Output = Complex

The resulting type after applying the + operator.

impl<'_> Add<&'_ i128> for Rational[src]

type Output = Rational

The resulting type after applying the + operator.

impl<'b, '_> Add<&'_ i128> for &'b Rational[src]

type Output = AddI128Incomplete<'b>

The resulting type after applying the + operator.

impl<'_> Add<&'_ i16> for Rational[src]

type Output = Rational

The resulting type after applying the + operator.

impl<'b, '_> Add<&'_ i16> for &'b Rational[src]

type Output = AddI16Incomplete<'b>

The resulting type after applying the + operator.

impl<'_> Add<&'_ i32> for Rational[src]

type Output = Rational

The resulting type after applying the + operator.

impl<'b, '_> Add<&'_ i32> for &'b Rational[src]

type Output = AddI32Incomplete<'b>

The resulting type after applying the + operator.

impl<'_> Add<&'_ i64> for Rational[src]

type Output = Rational

The resulting type after applying the + operator.

impl<'b, '_> Add<&'_ i64> for &'b Rational[src]

type Output = AddI64Incomplete<'b>

The resulting type after applying the + operator.

impl<'_> Add<&'_ i8> for Rational[src]

type Output = Rational

The resulting type after applying the + operator.

impl<'b, '_> Add<&'_ i8> for &'b Rational[src]

type Output = AddI8Incomplete<'b>

The resulting type after applying the + operator.

impl<'_> Add<&'_ u128> for Rational[src]

type Output = Rational

The resulting type after applying the + operator.

impl<'b, '_> Add<&'_ u128> for &'b Rational[src]

type Output = AddU128Incomplete<'b>

The resulting type after applying the + operator.

impl<'_> Add<&'_ u16> for Rational[src]

type Output = Rational

The resulting type after applying the + operator.

impl<'b, '_> Add<&'_ u16> for &'b Rational[src]

type Output = AddU16Incomplete<'b>

The resulting type after applying the + operator.

impl<'_> Add<&'_ u32> for Rational[src]

type Output = Rational

The resulting type after applying the + operator.

impl<'b, '_> Add<&'_ u32> for &'b Rational[src]

type Output = AddU32Incomplete<'b>

The resulting type after applying the + operator.

impl<'_> Add<&'_ u64> for Rational[src]

type Output = Rational

The resulting type after applying the + operator.

impl<'b, '_> Add<&'_ u64> for &'b Rational[src]

type Output = AddU64Incomplete<'b>

The resulting type after applying the + operator.

impl<'_> Add<&'_ u8> for Rational[src]

type Output = Rational

The resulting type after applying the + operator.

impl<'b, '_> Add<&'_ u8> for &'b Rational[src]

type Output = AddU8Incomplete<'b>

The resulting type after applying the + operator.

impl<'a> Add<&'a Complex> for Rational[src]

type Output = AddOwnedRationalIncomplete<'a>

The resulting type after applying the + operator.

impl<'a> Add<&'a Complex> for &'a Rational[src]

type Output = AddRationalIncomplete<'a>

The resulting type after applying the + operator.

impl<'a> Add<&'a Float> for Rational[src]

type Output = AddOwnedRationalIncomplete<'a>

The resulting type after applying the + operator.

impl<'a> Add<&'a Float> for &'a Rational[src]

type Output = AddRationalIncomplete<'a>

The resulting type after applying the + operator.

impl<'a> Add<&'a Integer> for &'a Rational[src]

type Output = AddIntegerIncomplete<'a>

The resulting type after applying the + operator.

impl<'a> Add<&'a Rational> for &'a Rational[src]

type Output = AddIncomplete<'a>

The resulting type after applying the + operator.

impl<'a> Add<&'a Rational> for Integer[src]

type Output = AddOwnedIntegerIncomplete<'a>

The resulting type after applying the + operator.

impl<'a> Add<&'a Rational> for &'a Integer[src]

type Output = AddIntegerIncomplete<'a>

The resulting type after applying the + operator.

impl<'a> Add<&'a Rational> for &'a Float[src]

type Output = AddRationalIncomplete<'a>

The resulting type after applying the + operator.

impl<'a> Add<&'a Rational> for &'a Complex[src]

type Output = AddRationalIncomplete<'a>

The resulting type after applying the + operator.

impl<'b> Add<&'b Rational> for i8[src]

type Output = AddI8Incomplete<'b>

The resulting type after applying the + operator.

impl<'b, '_> Add<&'b Rational> for &'_ i8[src]

type Output = AddI8Incomplete<'b>

The resulting type after applying the + operator.

impl<'b> Add<&'b Rational> for u8[src]

type Output = AddU8Incomplete<'b>

The resulting type after applying the + operator.

impl<'b, '_> Add<&'b Rational> for &'_ u8[src]

type Output = AddU8Incomplete<'b>

The resulting type after applying the + operator.

impl<'b> Add<&'b Rational> for u16[src]

type Output = AddU16Incomplete<'b>

The resulting type after applying the + operator.

impl<'b, '_> Add<&'b Rational> for &'_ u16[src]

type Output = AddU16Incomplete<'b>

The resulting type after applying the + operator.

impl<'b> Add<&'b Rational> for u32[src]

type Output = AddU32Incomplete<'b>

The resulting type after applying the + operator.

impl<'b, '_> Add<&'b Rational> for &'_ u32[src]

type Output = AddU32Incomplete<'b>

The resulting type after applying the + operator.

impl<'b> Add<&'b Rational> for u64[src]

type Output = AddU64Incomplete<'b>

The resulting type after applying the + operator.

impl<'b, '_> Add<&'b Rational> for &'_ u64[src]

type Output = AddU64Incomplete<'b>

The resulting type after applying the + operator.

impl<'b> Add<&'b Rational> for u128[src]

type Output = AddU128Incomplete<'b>

The resulting type after applying the + operator.

impl<'b, '_> Add<&'b Rational> for &'_ u128[src]

type Output = AddU128Incomplete<'b>

The resulting type after applying the + operator.

impl<'b> Add<&'b Rational> for i16[src]

type Output = AddI16Incomplete<'b>

The resulting type after applying the + operator.

impl<'b, '_> Add<&'b Rational> for &'_ i16[src]

type Output = AddI16Incomplete<'b>

The resulting type after applying the + operator.

impl<'b> Add<&'b Rational> for i32[src]

type Output = AddI32Incomplete<'b>

The resulting type after applying the + operator.

impl<'b, '_> Add<&'b Rational> for &'_ i32[src]

type Output = AddI32Incomplete<'b>

The resulting type after applying the + operator.

impl<'b> Add<&'b Rational> for i64[src]

type Output = AddI64Incomplete<'b>

The resulting type after applying the + operator.

impl<'b, '_> Add<&'b Rational> for &'_ i64[src]

type Output = AddI64Incomplete<'b>

The resulting type after applying the + operator.

impl<'b> Add<&'b Rational> for i128[src]

type Output = AddI128Incomplete<'b>

The resulting type after applying the + operator.

impl<'b, '_> Add<&'b Rational> for &'_ i128[src]

type Output = AddI128Incomplete<'b>

The resulting type after applying the + operator.

impl Add<Complex> for Rational[src]

type Output = Complex

The resulting type after applying the + operator.

impl<'_> Add<Complex> for &'_ Rational[src]

type Output = Complex

The resulting type after applying the + operator.

impl Add<Float> for Rational[src]

type Output = Float

The resulting type after applying the + operator.

impl<'_> Add<Float> for &'_ Rational[src]

type Output = Float

The resulting type after applying the + operator.

impl Add<Integer> for Rational[src]

type Output = Rational

The resulting type after applying the + operator.

impl<'a> Add<Integer> for &'a Rational[src]

type Output = AddOwnedIntegerIncomplete<'a>

The resulting type after applying the + operator.

impl Add<Rational> for Rational[src]

type Output = Rational

The resulting type after applying the + operator.

impl<'_> Add<Rational> for &'_ Rational[src]

type Output = Rational

The resulting type after applying the + operator.

impl Add<Rational> for i64[src]

type Output = Rational

The resulting type after applying the + operator.

impl<'_> Add<Rational> for &'_ i64[src]

type Output = Rational

The resulting type after applying the + operator.

impl Add<Rational> for i128[src]

type Output = Rational

The resulting type after applying the + operator.

impl<'_> Add<Rational> for &'_ i128[src]

type Output = Rational

The resulting type after applying the + operator.

impl Add<Rational> for u8[src]

type Output = Rational

The resulting type after applying the + operator.

impl<'_> Add<Rational> for &'_ u8[src]

type Output = Rational

The resulting type after applying the + operator.

impl Add<Rational> for u16[src]

type Output = Rational

The resulting type after applying the + operator.

impl<'_> Add<Rational> for &'_ u16[src]

type Output = Rational

The resulting type after applying the + operator.

impl Add<Rational> for u32[src]

type Output = Rational

The resulting type after applying the + operator.

impl<'_> Add<Rational> for &'_ u32[src]

type Output = Rational

The resulting type after applying the + operator.

impl Add<Rational> for Integer[src]

type Output = Rational

The resulting type after applying the + operator.

impl Add<Rational> for u64[src]

type Output = Rational

The resulting type after applying the + operator.

impl<'_> Add<Rational> for &'_ u64[src]

type Output = Rational

The resulting type after applying the + operator.

impl Add<Rational> for u128[src]

type Output = Rational

The resulting type after applying the + operator.

impl<'_> Add<Rational> for &'_ u128[src]

type Output = Rational

The resulting type after applying the + operator.

impl Add<Rational> for Float[src]

type Output = Float

The resulting type after applying the + operator.

impl<'a> Add<Rational> for &'a Float[src]

type Output = AddOwnedRationalIncomplete<'a>

The resulting type after applying the + operator.

impl Add<Rational> for Complex[src]

type Output = Complex

The resulting type after applying the + operator.

impl<'a> Add<Rational> for &'a Complex[src]

type Output = AddOwnedRationalIncomplete<'a>

The resulting type after applying the + operator.

impl<'_> Add<Rational> for &'_ Integer[src]

type Output = Rational

The resulting type after applying the + operator.

impl Add<Rational> for i8[src]

type Output = Rational

The resulting type after applying the + operator.

impl<'_> Add<Rational> for &'_ i8[src]

type Output = Rational

The resulting type after applying the + operator.

impl Add<Rational> for i16[src]

type Output = Rational

The resulting type after applying the + operator.

impl<'_> Add<Rational> for &'_ i16[src]

type Output = Rational

The resulting type after applying the + operator.

impl Add<Rational> for i32[src]

type Output = Rational

The resulting type after applying the + operator.

impl<'_> Add<Rational> for &'_ i32[src]

type Output = Rational

The resulting type after applying the + operator.

impl Add<i128> for Rational[src]

type Output = Rational

The resulting type after applying the + operator.

impl<'b> Add<i128> for &'b Rational[src]

type Output = AddI128Incomplete<'b>

The resulting type after applying the + operator.

impl Add<i16> for Rational[src]

type Output = Rational

The resulting type after applying the + operator.

impl<'b> Add<i16> for &'b Rational[src]

type Output = AddI16Incomplete<'b>

The resulting type after applying the + operator.

impl Add<i32> for Rational[src]

type Output = Rational

The resulting type after applying the + operator.

impl<'b> Add<i32> for &'b Rational[src]

type Output = AddI32Incomplete<'b>

The resulting type after applying the + operator.

impl Add<i64> for Rational[src]

type Output = Rational

The resulting type after applying the + operator.

impl<'b> Add<i64> for &'b Rational[src]

type Output = AddI64Incomplete<'b>

The resulting type after applying the + operator.

impl Add<i8> for Rational[src]

type Output = Rational

The resulting type after applying the + operator.

impl<'b> Add<i8> for &'b Rational[src]

type Output = AddI8Incomplete<'b>

The resulting type after applying the + operator.

impl Add<u128> for Rational[src]

type Output = Rational

The resulting type after applying the + operator.

impl<'b> Add<u128> for &'b Rational[src]

type Output = AddU128Incomplete<'b>

The resulting type after applying the + operator.

impl Add<u16> for Rational[src]

type Output = Rational

The resulting type after applying the + operator.

impl<'b> Add<u16> for &'b Rational[src]

type Output = AddU16Incomplete<'b>

The resulting type after applying the + operator.

impl Add<u32> for Rational[src]

type Output = Rational

The resulting type after applying the + operator.

impl<'b> Add<u32> for &'b Rational[src]

type Output = AddU32Incomplete<'b>

The resulting type after applying the + operator.

impl Add<u64> for Rational[src]

type Output = Rational

The resulting type after applying the + operator.

impl<'b> Add<u64> for &'b Rational[src]

type Output = AddU64Incomplete<'b>

The resulting type after applying the + operator.

impl Add<u8> for Rational[src]

type Output = Rational

The resulting type after applying the + operator.

impl<'b> Add<u8> for &'b Rational[src]

type Output = AddU8Incomplete<'b>

The resulting type after applying the + operator.

impl<'_> AddAssign<&'_ Integer> for Rational[src]

impl<'_> AddAssign<&'_ Rational> for Rational[src]

impl<'_> AddAssign<&'_ Rational> for Float[src]

impl<'_> AddAssign<&'_ Rational> for Complex[src]

impl<'_> AddAssign<&'_ i128> for Rational[src]

impl<'_> AddAssign<&'_ i16> for Rational[src]

impl<'_> AddAssign<&'_ i32> for Rational[src]

impl<'_> AddAssign<&'_ i64> for Rational[src]

impl<'_> AddAssign<&'_ i8> for Rational[src]

impl<'_> AddAssign<&'_ u128> for Rational[src]

impl<'_> AddAssign<&'_ u16> for Rational[src]

impl<'_> AddAssign<&'_ u32> for Rational[src]

impl<'_> AddAssign<&'_ u64> for Rational[src]

impl<'_> AddAssign<&'_ u8> for Rational[src]

impl AddAssign<Integer> for Rational[src]

impl AddAssign<Rational> for Rational[src]

impl AddAssign<Rational> for Float[src]

impl AddAssign<Rational> for Complex[src]

impl AddAssign<i128> for Rational[src]

impl AddAssign<i16> for Rational[src]

impl AddAssign<i32> for Rational[src]

impl AddAssign<i64> for Rational[src]

impl AddAssign<i8> for Rational[src]

impl AddAssign<u128> for Rational[src]

impl AddAssign<u16> for Rational[src]

impl AddAssign<u32> for Rational[src]

impl AddAssign<u64> for Rational[src]

impl AddAssign<u8> for Rational[src]

impl<'_> AddAssignRound<&'_ Rational> for Float[src]

type Round = Round

The rounding method.

type Ordering = Ordering

The direction from rounding.

impl<'_> AddAssignRound<&'_ Rational> for Complex[src]

type Round = (Round, Round)

The rounding method.

type Ordering = (Ordering, Ordering)

The direction from rounding.

impl AddAssignRound<Rational> for Float[src]

type Round = Round

The rounding method.

type Ordering = Ordering

The direction from rounding.

impl AddAssignRound<Rational> for Complex[src]

type Round = (Round, Round)

The rounding method.

type Ordering = (Ordering, Ordering)

The direction from rounding.

impl<'_> AddFrom<&'_ Integer> for Rational[src]

impl<'_> AddFrom<&'_ Rational> for Rational[src]

impl<'_> AddFrom<&'_ Rational> for Float[src]

impl<'_> AddFrom<&'_ Rational> for Complex[src]

impl<'_> AddFrom<&'_ i128> for Rational[src]

impl<'_> AddFrom<&'_ i16> for Rational[src]

impl<'_> AddFrom<&'_ i32> for Rational[src]

impl<'_> AddFrom<&'_ i64> for Rational[src]

impl<'_> AddFrom<&'_ i8> for Rational[src]

impl<'_> AddFrom<&'_ u128> for Rational[src]

impl<'_> AddFrom<&'_ u16> for Rational[src]

impl<'_> AddFrom<&'_ u32> for Rational[src]

impl<'_> AddFrom<&'_ u64> for Rational[src]

impl<'_> AddFrom<&'_ u8> for Rational[src]

impl AddFrom<Integer> for Rational[src]

impl AddFrom<Rational> for Rational[src]

impl AddFrom<Rational> for Float[src]

impl AddFrom<Rational> for Complex[src]

impl AddFrom<i128> for Rational[src]

impl AddFrom<i16> for Rational[src]

impl AddFrom<i32> for Rational[src]

impl AddFrom<i64> for Rational[src]

impl AddFrom<i8> for Rational[src]

impl AddFrom<u128> for Rational[src]

impl AddFrom<u16> for Rational[src]

impl AddFrom<u32> for Rational[src]

impl AddFrom<u64> for Rational[src]

impl AddFrom<u8> for Rational[src]

impl<'_> AddFromRound<&'_ Rational> for Float[src]

type Round = Round

The rounding method.

type Ordering = Ordering

The direction from rounding.

impl<'_> AddFromRound<&'_ Rational> for Complex[src]

type Round = (Round, Round)

The rounding method.

type Ordering = (Ordering, Ordering)

The direction from rounding.

impl AddFromRound<Rational> for Float[src]

type Round = Round

The rounding method.

type Ordering = Ordering

The direction from rounding.

impl AddFromRound<Rational> for Complex[src]

type Round = (Round, Round)

The rounding method.

type Ordering = (Ordering, Ordering)

The direction from rounding.

impl<'_> Assign<&'_ Rational> for Rational[src]

impl<'a, Num, Den> Assign<&'a (Num, Den)> for Rational where
    Integer: Assign<&'a Num> + Assign<&'a Den>, 
[src]

impl<Num, Den> Assign<(Num, Den)> for Rational where
    Integer: Assign<Num> + Assign<Den>, 
[src]

impl<Num> Assign<Num> for Rational where
    Integer: Assign<Num>, 
[src]

impl Assign<Rational> for Rational[src]

impl<'_> AssignRound<&'_ Rational> for Float[src]

type Round = Round

The rounding method.

type Ordering = Ordering

The direction from rounding.

impl AssignRound<Rational> for Float[src]

type Round = Round

The rounding method.

type Ordering = Ordering

The direction from rounding.

impl Binary for Rational[src]

impl Cast<Rational> for bool[src]

impl Cast<Rational> for i8[src]

impl Cast<Rational> for u64[src]

impl Cast<Rational> for u128[src]

impl Cast<Rational> for usize[src]

impl Cast<Rational> for f32[src]

impl Cast<Rational> for f64[src]

impl Cast<Rational> for Integer[src]

impl<'_> Cast<Rational> for &'_ Integer[src]

impl Cast<Rational> for Float[src]

impl<'_> Cast<Rational> for &'_ Float[src]

impl Cast<Rational> for i16[src]

impl Cast<Rational> for i32[src]

impl Cast<Rational> for i64[src]

impl Cast<Rational> for i128[src]

impl Cast<Rational> for isize[src]

impl Cast<Rational> for u8[src]

impl Cast<Rational> for u16[src]

impl Cast<Rational> for u32[src]

impl Cast<f32> for Rational[src]

impl<'_> Cast<f32> for &'_ Rational[src]

impl Cast<f64> for Rational[src]

impl<'_> Cast<f64> for &'_ Rational[src]

impl CheckedCast<Rational> for f32[src]

impl CheckedCast<Rational> for f64[src]

impl CheckedCast<Rational> for Float[src]

impl<'_> CheckedCast<Rational> for &'_ Float[src]

impl Clone for Rational[src]

impl Debug for Rational[src]

impl Default for Rational[src]

impl<'de> Deserialize<'de> for Rational[src]

impl Display for Rational[src]

impl<'_> Div<&'_ Integer> for Rational[src]

type Output = Rational

The resulting type after applying the / operator.

impl<'_> Div<&'_ Rational> for Rational[src]

type Output = Rational

The resulting type after applying the / operator.

impl<'_> Div<&'_ Rational> for Float[src]

type Output = Float

The resulting type after applying the / operator.

impl<'_> Div<&'_ Rational> for Complex[src]

type Output = Complex

The resulting type after applying the / operator.

impl<'_> Div<&'_ i128> for Rational[src]

type Output = Rational

The resulting type after applying the / operator.

impl<'b, '_> Div<&'_ i128> for &'b Rational[src]

type Output = DivI128Incomplete<'b>

The resulting type after applying the / operator.

impl<'_> Div<&'_ i16> for Rational[src]

type Output = Rational

The resulting type after applying the / operator.

impl<'b, '_> Div<&'_ i16> for &'b Rational[src]

type Output = DivI16Incomplete<'b>

The resulting type after applying the / operator.

impl<'_> Div<&'_ i32> for Rational[src]

type Output = Rational

The resulting type after applying the / operator.

impl<'b, '_> Div<&'_ i32> for &'b Rational[src]

type Output = DivI32Incomplete<'b>

The resulting type after applying the / operator.

impl<'_> Div<&'_ i64> for Rational[src]

type Output = Rational

The resulting type after applying the / operator.

impl<'b, '_> Div<&'_ i64> for &'b Rational[src]

type Output = DivI64Incomplete<'b>

The resulting type after applying the / operator.

impl<'_> Div<&'_ i8> for Rational[src]

type Output = Rational

The resulting type after applying the / operator.

impl<'b, '_> Div<&'_ i8> for &'b Rational[src]

type Output = DivI8Incomplete<'b>

The resulting type after applying the / operator.

impl<'_> Div<&'_ u128> for Rational[src]

type Output = Rational

The resulting type after applying the / operator.

impl<'b, '_> Div<&'_ u128> for &'b Rational[src]

type Output = DivU128Incomplete<'b>

The resulting type after applying the / operator.

impl<'_> Div<&'_ u16> for Rational[src]

type Output = Rational

The resulting type after applying the / operator.

impl<'b, '_> Div<&'_ u16> for &'b Rational[src]

type Output = DivU16Incomplete<'b>

The resulting type after applying the / operator.

impl<'_> Div<&'_ u32> for Rational[src]

type Output = Rational

The resulting type after applying the / operator.

impl<'b, '_> Div<&'_ u32> for &'b Rational[src]

type Output = DivU32Incomplete<'b>

The resulting type after applying the / operator.

impl<'_> Div<&'_ u64> for Rational[src]

type Output = Rational

The resulting type after applying the / operator.

impl<'b, '_> Div<&'_ u64> for &'b Rational[src]

type Output = DivU64Incomplete<'b>

The resulting type after applying the / operator.

impl<'_> Div<&'_ u8> for Rational[src]

type Output = Rational

The resulting type after applying the / operator.

impl<'b, '_> Div<&'_ u8> for &'b Rational[src]

type Output = DivU8Incomplete<'b>

The resulting type after applying the / operator.

impl<'a> Div<&'a Float> for Rational[src]

type Output = DivFromOwnedRationalIncomplete<'a>

The resulting type after applying the / operator.

impl<'a> Div<&'a Float> for &'a Rational[src]

type Output = DivFromRationalIncomplete<'a>

The resulting type after applying the / operator.

impl<'a> Div<&'a Integer> for &'a Rational[src]

type Output = DivIntegerIncomplete<'a>

The resulting type after applying the / operator.

impl<'a> Div<&'a Rational> for &'a Rational[src]

type Output = DivIncomplete<'a>

The resulting type after applying the / operator.

impl<'a> Div<&'a Rational> for Integer[src]

type Output = DivFromOwnedIntegerIncomplete<'a>

The resulting type after applying the / operator.

impl<'a> Div<&'a Rational> for &'a Integer[src]

type Output = DivFromIntegerIncomplete<'a>

The resulting type after applying the / operator.

impl<'a> Div<&'a Rational> for &'a Float[src]

type Output = DivRationalIncomplete<'a>

The resulting type after applying the / operator.

impl<'a> Div<&'a Rational> for &'a Complex[src]

type Output = DivRationalIncomplete<'a>

The resulting type after applying the / operator.

impl<'b> Div<&'b Rational> for i8[src]

type Output = DivFromI8Incomplete<'b>

The resulting type after applying the / operator.

impl<'b, '_> Div<&'b Rational> for &'_ i8[src]

type Output = DivFromI8Incomplete<'b>

The resulting type after applying the / operator.

impl<'b> Div<&'b Rational> for u8[src]

type Output = DivFromU8Incomplete<'b>

The resulting type after applying the / operator.

impl<'b, '_> Div<&'b Rational> for &'_ u8[src]

type Output = DivFromU8Incomplete<'b>

The resulting type after applying the / operator.

impl<'b> Div<&'b Rational> for u16[src]

type Output = DivFromU16Incomplete<'b>

The resulting type after applying the / operator.

impl<'b, '_> Div<&'b Rational> for &'_ u16[src]

type Output = DivFromU16Incomplete<'b>

The resulting type after applying the / operator.

impl<'b> Div<&'b Rational> for u32[src]

type Output = DivFromU32Incomplete<'b>

The resulting type after applying the / operator.

impl<'b, '_> Div<&'b Rational> for &'_ u32[src]

type Output = DivFromU32Incomplete<'b>

The resulting type after applying the / operator.

impl<'b> Div<&'b Rational> for u64[src]

type Output = DivFromU64Incomplete<'b>

The resulting type after applying the / operator.

impl<'b, '_> Div<&'b Rational> for &'_ u64[src]

type Output = DivFromU64Incomplete<'b>

The resulting type after applying the / operator.

impl<'b> Div<&'b Rational> for u128[src]

type Output = DivFromU128Incomplete<'b>

The resulting type after applying the / operator.

impl<'b, '_> Div<&'b Rational> for &'_ u128[src]

type Output = DivFromU128Incomplete<'b>

The resulting type after applying the / operator.

impl<'b> Div<&'b Rational> for i16[src]

type Output = DivFromI16Incomplete<'b>

The resulting type after applying the / operator.

impl<'b, '_> Div<&'b Rational> for &'_ i16[src]

type Output = DivFromI16Incomplete<'b>

The resulting type after applying the / operator.

impl<'b> Div<&'b Rational> for i32[src]

type Output = DivFromI32Incomplete<'b>

The resulting type after applying the / operator.

impl<'b, '_> Div<&'b Rational> for &'_ i32[src]

type Output = DivFromI32Incomplete<'b>

The resulting type after applying the / operator.

impl<'b> Div<&'b Rational> for i64[src]

type Output = DivFromI64Incomplete<'b>

The resulting type after applying the / operator.

impl<'b, '_> Div<&'b Rational> for &'_ i64[src]

type Output = DivFromI64Incomplete<'b>

The resulting type after applying the / operator.

impl<'b> Div<&'b Rational> for i128[src]

type Output = DivFromI128Incomplete<'b>

The resulting type after applying the / operator.

impl<'b, '_> Div<&'b Rational> for &'_ i128[src]

type Output = DivFromI128Incomplete<'b>

The resulting type after applying the / operator.

impl Div<Float> for Rational[src]

type Output = Float

The resulting type after applying the / operator.

impl<'_> Div<Float> for &'_ Rational[src]

type Output = Float

The resulting type after applying the / operator.

impl Div<Integer> for Rational[src]

type Output = Rational

The resulting type after applying the / operator.

impl<'a> Div<Integer> for &'a Rational[src]

type Output = DivOwnedIntegerIncomplete<'a>

The resulting type after applying the / operator.

impl Div<Rational> for Rational[src]

type Output = Rational

The resulting type after applying the / operator.

impl<'_> Div<Rational> for &'_ Rational[src]

type Output = Rational

The resulting type after applying the / operator.

impl Div<Rational> for i64[src]

type Output = Rational

The resulting type after applying the / operator.

impl<'_> Div<Rational> for &'_ i64[src]

type Output = Rational

The resulting type after applying the / operator.

impl Div<Rational> for i128[src]

type Output = Rational

The resulting type after applying the / operator.

impl<'_> Div<Rational> for &'_ i128[src]

type Output = Rational

The resulting type after applying the / operator.

impl Div<Rational> for u8[src]

type Output = Rational

The resulting type after applying the / operator.

impl<'_> Div<Rational> for &'_ u8[src]

type Output = Rational

The resulting type after applying the / operator.

impl Div<Rational> for u16[src]

type Output = Rational

The resulting type after applying the / operator.

impl<'_> Div<Rational> for &'_ u16[src]

type Output = Rational

The resulting type after applying the / operator.

impl Div<Rational> for u32[src]

type Output = Rational

The resulting type after applying the / operator.

impl<'_> Div<Rational> for &'_ u32[src]

type Output = Rational

The resulting type after applying the / operator.

impl Div<Rational> for Integer[src]

type Output = Rational

The resulting type after applying the / operator.

impl Div<Rational> for u64[src]

type Output = Rational

The resulting type after applying the / operator.

impl<'_> Div<Rational> for &'_ u64[src]

type Output = Rational

The resulting type after applying the / operator.

impl Div<Rational> for u128[src]

type Output = Rational

The resulting type after applying the / operator.

impl<'_> Div<Rational> for &'_ u128[src]

type Output = Rational

The resulting type after applying the / operator.

impl Div<Rational> for Float[src]

type Output = Float

The resulting type after applying the / operator.

impl<'a> Div<Rational> for &'a Float[src]

type Output = DivOwnedRationalIncomplete<'a>

The resulting type after applying the / operator.

impl Div<Rational> for Complex[src]

type Output = Complex

The resulting type after applying the / operator.

impl<'a> Div<Rational> for &'a Complex[src]

type Output = DivOwnedRationalIncomplete<'a>

The resulting type after applying the / operator.

impl<'_> Div<Rational> for &'_ Integer[src]

type Output = Rational

The resulting type after applying the / operator.

impl Div<Rational> for i8[src]

type Output = Rational

The resulting type after applying the / operator.

impl<'_> Div<Rational> for &'_ i8[src]

type Output = Rational

The resulting type after applying the / operator.

impl Div<Rational> for i16[src]

type Output = Rational

The resulting type after applying the / operator.

impl<'_> Div<Rational> for &'_ i16[src]

type Output = Rational

The resulting type after applying the / operator.

impl Div<Rational> for i32[src]

type Output = Rational

The resulting type after applying the / operator.

impl<'_> Div<Rational> for &'_ i32[src]

type Output = Rational

The resulting type after applying the / operator.

impl Div<i128> for Rational[src]

type Output = Rational

The resulting type after applying the / operator.

impl<'b> Div<i128> for &'b Rational[src]

type Output = DivI128Incomplete<'b>

The resulting type after applying the / operator.

impl Div<i16> for Rational[src]

type Output = Rational

The resulting type after applying the / operator.

impl<'b> Div<i16> for &'b Rational[src]

type Output = DivI16Incomplete<'b>

The resulting type after applying the / operator.

impl Div<i32> for Rational[src]

type Output = Rational

The resulting type after applying the / operator.

impl<'b> Div<i32> for &'b Rational[src]

type Output = DivI32Incomplete<'b>

The resulting type after applying the / operator.

impl Div<i64> for Rational[src]

type Output = Rational

The resulting type after applying the / operator.

impl<'b> Div<i64> for &'b Rational[src]

type Output = DivI64Incomplete<'b>

The resulting type after applying the / operator.

impl Div<i8> for Rational[src]

type Output = Rational

The resulting type after applying the / operator.

impl<'b> Div<i8> for &'b Rational[src]

type Output = DivI8Incomplete<'b>

The resulting type after applying the / operator.

impl Div<u128> for Rational[src]

type Output = Rational

The resulting type after applying the / operator.

impl<'b> Div<u128> for &'b Rational[src]

type Output = DivU128Incomplete<'b>

The resulting type after applying the / operator.

impl Div<u16> for Rational[src]

type Output = Rational

The resulting type after applying the / operator.

impl<'b> Div<u16> for &'b Rational[src]

type Output = DivU16Incomplete<'b>

The resulting type after applying the / operator.

impl Div<u32> for Rational[src]

type Output = Rational

The resulting type after applying the / operator.

impl<'b> Div<u32> for &'b Rational[src]

type Output = DivU32Incomplete<'b>

The resulting type after applying the / operator.

impl Div<u64> for Rational[src]

type Output = Rational

The resulting type after applying the / operator.

impl<'b> Div<u64> for &'b Rational[src]

type Output = DivU64Incomplete<'b>

The resulting type after applying the / operator.

impl Div<u8> for Rational[src]

type Output = Rational

The resulting type after applying the / operator.

impl<'b> Div<u8> for &'b Rational[src]

type Output = DivU8Incomplete<'b>

The resulting type after applying the / operator.

impl<'_> DivAssign<&'_ Integer> for Rational[src]

impl<'_> DivAssign<&'_ Rational> for Rational[src]

impl<'_> DivAssign<&'_ Rational> for Float[src]

impl<'_> DivAssign<&'_ Rational> for Complex[src]

impl<'_> DivAssign<&'_ i128> for Rational[src]

impl<'_> DivAssign<&'_ i16> for Rational[src]

impl<'_> DivAssign<&'_ i32> for Rational[src]

impl<'_> DivAssign<&'_ i64> for Rational[src]

impl<'_> DivAssign<&'_ i8> for Rational[src]

impl<'_> DivAssign<&'_ u128> for Rational[src]

impl<'_> DivAssign<&'_ u16> for Rational[src]

impl<'_> DivAssign<&'_ u32> for Rational[src]

impl<'_> DivAssign<&'_ u64> for Rational[src]

impl<'_> DivAssign<&'_ u8> for Rational[src]

impl DivAssign<Integer> for Rational[src]

impl DivAssign<Rational> for Rational[src]

impl DivAssign<Rational> for Float[src]

impl DivAssign<Rational> for Complex[src]

impl DivAssign<i128> for Rational[src]

impl DivAssign<i16> for Rational[src]

impl DivAssign<i32> for Rational[src]

impl DivAssign<i64> for Rational[src]

impl DivAssign<i8> for Rational[src]

impl DivAssign<u128> for Rational[src]

impl DivAssign<u16> for Rational[src]

impl DivAssign<u32> for Rational[src]

impl DivAssign<u64> for Rational[src]

impl DivAssign<u8> for Rational[src]

impl<'_> DivAssignRound<&'_ Rational> for Float[src]

type Round = Round

The rounding method.

type Ordering = Ordering

The direction from rounding.

impl<'_> DivAssignRound<&'_ Rational> for Complex[src]

type Round = (Round, Round)

The rounding method.

type Ordering = (Ordering, Ordering)

The direction from rounding.

impl DivAssignRound<Rational> for Float[src]

type Round = Round

The rounding method.

type Ordering = Ordering

The direction from rounding.

impl DivAssignRound<Rational> for Complex[src]

type Round = (Round, Round)

The rounding method.

type Ordering = (Ordering, Ordering)

The direction from rounding.

impl<'_> DivFrom<&'_ Integer> for Rational[src]

impl<'_> DivFrom<&'_ Rational> for Rational[src]

impl<'_> DivFrom<&'_ Rational> for Float[src]

impl<'_> DivFrom<&'_ i128> for Rational[src]

impl<'_> DivFrom<&'_ i16> for Rational[src]

impl<'_> DivFrom<&'_ i32> for Rational[src]

impl<'_> DivFrom<&'_ i64> for Rational[src]

impl<'_> DivFrom<&'_ i8> for Rational[src]

impl<'_> DivFrom<&'_ u128> for Rational[src]

impl<'_> DivFrom<&'_ u16> for Rational[src]

impl<'_> DivFrom<&'_ u32> for Rational[src]

impl<'_> DivFrom<&'_ u64> for Rational[src]

impl<'_> DivFrom<&'_ u8> for Rational[src]

impl DivFrom<Integer> for Rational[src]

impl DivFrom<Rational> for Rational[src]

impl DivFrom<Rational> for Float[src]

impl DivFrom<i128> for Rational[src]

impl DivFrom<i16> for Rational[src]

impl DivFrom<i32> for Rational[src]

impl DivFrom<i64> for Rational[src]

impl DivFrom<i8> for Rational[src]

impl DivFrom<u128> for Rational[src]

impl DivFrom<u16> for Rational[src]

impl DivFrom<u32> for Rational[src]

impl DivFrom<u64> for Rational[src]

impl DivFrom<u8> for Rational[src]

impl<'_> DivFromRound<&'_ Rational> for Float[src]

type Round = Round

The rounding method.

type Ordering = Ordering

The direction from rounding.

impl DivFromRound<Rational> for Float[src]

type Round = Round

The rounding method.

type Ordering = Ordering

The direction from rounding.

impl Drop for Rational[src]

impl Eq for Rational[src]

impl<'_> From<&'_ Rational> for Rational[src]

impl<'a, Num, Den> From<&'a (Num, Den)> for Rational where
    Integer: From<&'a Num> + From<&'a Den>, 
[src]

impl<Num, Den> From<(Num, Den)> for Rational where
    Integer: From<Num> + From<Den>, 
[src]

impl<Num> From<Num> for Rational where
    Integer: From<Num>, 
[src]

impl FromStr for Rational[src]

type Err = ParseRationalError

The associated error which can be returned from parsing.

impl Hash for Rational[src]

impl LowerHex for Rational[src]

impl<'_> Mul<&'_ Integer> for Rational[src]

type Output = Rational

The resulting type after applying the * operator.

impl<'_> Mul<&'_ Rational> for Rational[src]

type Output = Rational

The resulting type after applying the * operator.

impl<'_> Mul<&'_ Rational> for Float[src]

type Output = Float

The resulting type after applying the * operator.

impl<'_> Mul<&'_ Rational> for Complex[src]

type Output = Complex

The resulting type after applying the * operator.

impl<'_> Mul<&'_ i128> for Rational[src]

type Output = Rational

The resulting type after applying the * operator.

impl<'b, '_> Mul<&'_ i128> for &'b Rational[src]

type Output = MulI128Incomplete<'b>

The resulting type after applying the * operator.

impl<'_> Mul<&'_ i16> for Rational[src]

type Output = Rational

The resulting type after applying the * operator.

impl<'b, '_> Mul<&'_ i16> for &'b Rational[src]

type Output = MulI16Incomplete<'b>

The resulting type after applying the * operator.

impl<'_> Mul<&'_ i32> for Rational[src]

type Output = Rational

The resulting type after applying the * operator.

impl<'b, '_> Mul<&'_ i32> for &'b Rational[src]

type Output = MulI32Incomplete<'b>

The resulting type after applying the * operator.

impl<'_> Mul<&'_ i64> for Rational[src]

type Output = Rational

The resulting type after applying the * operator.

impl<'b, '_> Mul<&'_ i64> for &'b Rational[src]

type Output = MulI64Incomplete<'b>

The resulting type after applying the * operator.

impl<'_> Mul<&'_ i8> for Rational[src]

type Output = Rational

The resulting type after applying the * operator.

impl<'b, '_> Mul<&'_ i8> for &'b Rational[src]

type Output = MulI8Incomplete<'b>

The resulting type after applying the * operator.

impl<'_> Mul<&'_ u128> for Rational[src]

type Output = Rational

The resulting type after applying the * operator.

impl<'b, '_> Mul<&'_ u128> for &'b Rational[src]

type Output = MulU128Incomplete<'b>

The resulting type after applying the * operator.

impl<'_> Mul<&'_ u16> for Rational[src]

type Output = Rational

The resulting type after applying the * operator.

impl<'b, '_> Mul<&'_ u16> for &'b Rational[src]

type Output = MulU16Incomplete<'b>

The resulting type after applying the * operator.

impl<'_> Mul<&'_ u32> for Rational[src]

type Output = Rational

The resulting type after applying the * operator.

impl<'b, '_> Mul<&'_ u32> for &'b Rational[src]

type Output = MulU32Incomplete<'b>

The resulting type after applying the * operator.

impl<'_> Mul<&'_ u64> for Rational[src]

type Output = Rational

The resulting type after applying the * operator.

impl<'b, '_> Mul<&'_ u64> for &'b Rational[src]

type Output = MulU64Incomplete<'b>

The resulting type after applying the * operator.

impl<'_> Mul<&'_ u8> for Rational[src]

type Output = Rational

The resulting type after applying the * operator.

impl<'b, '_> Mul<&'_ u8> for &'b Rational[src]

type Output = MulU8Incomplete<'b>

The resulting type after applying the * operator.

impl<'a> Mul<&'a Complex> for Rational[src]

type Output = MulOwnedRationalIncomplete<'a>

The resulting type after applying the * operator.

impl<'a> Mul<&'a Complex> for &'a Rational[src]

type Output = MulRationalIncomplete<'a>

The resulting type after applying the * operator.

impl<'a> Mul<&'a Float> for Rational[src]

type Output = MulOwnedRationalIncomplete<'a>

The resulting type after applying the * operator.

impl<'a> Mul<&'a Float> for &'a Rational[src]

type Output = MulRationalIncomplete<'a>

The resulting type after applying the * operator.

impl<'a> Mul<&'a Integer> for &'a Rational[src]

type Output = MulIntegerIncomplete<'a>

The resulting type after applying the * operator.

impl<'a> Mul<&'a Rational> for &'a Rational[src]

type Output = MulIncomplete<'a>

The resulting type after applying the * operator.

impl<'a> Mul<&'a Rational> for Integer[src]

type Output = MulOwnedIntegerIncomplete<'a>

The resulting type after applying the * operator.

impl<'a> Mul<&'a Rational> for &'a Integer[src]

type Output = MulIntegerIncomplete<'a>

The resulting type after applying the * operator.

impl<'a> Mul<&'a Rational> for &'a Float[src]

type Output = MulRationalIncomplete<'a>

The resulting type after applying the * operator.

impl<'a> Mul<&'a Rational> for &'a Complex[src]

type Output = MulRationalIncomplete<'a>

The resulting type after applying the * operator.

impl<'b> Mul<&'b Rational> for i8[src]

type Output = MulI8Incomplete<'b>

The resulting type after applying the * operator.

impl<'b, '_> Mul<&'b Rational> for &'_ i8[src]

type Output = MulI8Incomplete<'b>

The resulting type after applying the * operator.

impl<'b> Mul<&'b Rational> for u8[src]

type Output = MulU8Incomplete<'b>

The resulting type after applying the * operator.

impl<'b, '_> Mul<&'b Rational> for &'_ u8[src]

type Output = MulU8Incomplete<'b>

The resulting type after applying the * operator.

impl<'b> Mul<&'b Rational> for u16[src]

type Output = MulU16Incomplete<'b>

The resulting type after applying the * operator.

impl<'b, '_> Mul<&'b Rational> for &'_ u16[src]

type Output = MulU16Incomplete<'b>

The resulting type after applying the * operator.

impl<'b> Mul<&'b Rational> for u32[src]

type Output = MulU32Incomplete<'b>

The resulting type after applying the * operator.

impl<'b, '_> Mul<&'b Rational> for &'_ u32[src]

type Output = MulU32Incomplete<'b>

The resulting type after applying the * operator.

impl<'b> Mul<&'b Rational> for u64[src]

type Output = MulU64Incomplete<'b>

The resulting type after applying the * operator.

impl<'b, '_> Mul<&'b Rational> for &'_ u64[src]

type Output = MulU64Incomplete<'b>

The resulting type after applying the * operator.

impl<'b> Mul<&'b Rational> for u128[src]

type Output = MulU128Incomplete<'b>

The resulting type after applying the * operator.

impl<'b, '_> Mul<&'b Rational> for &'_ u128[src]

type Output = MulU128Incomplete<'b>

The resulting type after applying the * operator.

impl<'b> Mul<&'b Rational> for i16[src]

type Output = MulI16Incomplete<'b>

The resulting type after applying the * operator.

impl<'b, '_> Mul<&'b Rational> for &'_ i16[src]

type Output = MulI16Incomplete<'b>

The resulting type after applying the * operator.

impl<'b> Mul<&'b Rational> for i32[src]

type Output = MulI32Incomplete<'b>

The resulting type after applying the * operator.

impl<'b, '_> Mul<&'b Rational> for &'_ i32[src]

type Output = MulI32Incomplete<'b>

The resulting type after applying the * operator.

impl<'b> Mul<&'b Rational> for i64[src]

type Output = MulI64Incomplete<'b>

The resulting type after applying the * operator.

impl<'b, '_> Mul<&'b Rational> for &'_ i64[src]

type Output = MulI64Incomplete<'b>

The resulting type after applying the * operator.

impl<'b> Mul<&'b Rational> for i128[src]

type Output = MulI128Incomplete<'b>

The resulting type after applying the * operator.

impl<'b, '_> Mul<&'b Rational> for &'_ i128[src]

type Output = MulI128Incomplete<'b>

The resulting type after applying the * operator.

impl Mul<Complex> for Rational[src]

type Output = Complex

The resulting type after applying the * operator.

impl<'_> Mul<Complex> for &'_ Rational[src]

type Output = Complex

The resulting type after applying the * operator.

impl Mul<Float> for Rational[src]

type Output = Float

The resulting type after applying the * operator.

impl<'_> Mul<Float> for &'_ Rational[src]

type Output = Float

The resulting type after applying the * operator.

impl Mul<Integer> for Rational[src]

type Output = Rational

The resulting type after applying the * operator.

impl<'a> Mul<Integer> for &'a Rational[src]

type Output = MulOwnedIntegerIncomplete<'a>

The resulting type after applying the * operator.

impl Mul<Rational> for Rational[src]

type Output = Rational

The resulting type after applying the * operator.

impl<'_> Mul<Rational> for &'_ Rational[src]

type Output = Rational

The resulting type after applying the * operator.

impl Mul<Rational> for i64[src]

type Output = Rational

The resulting type after applying the * operator.

impl<'_> Mul<Rational> for &'_ i64[src]

type Output = Rational

The resulting type after applying the * operator.

impl Mul<Rational> for i128[src]

type Output = Rational

The resulting type after applying the * operator.

impl<'_> Mul<Rational> for &'_ i128[src]

type Output = Rational

The resulting type after applying the * operator.

impl Mul<Rational> for u8[src]

type Output = Rational

The resulting type after applying the * operator.

impl<'_> Mul<Rational> for &'_ u8[src]

type Output = Rational

The resulting type after applying the * operator.

impl Mul<Rational> for u16[src]

type Output = Rational

The resulting type after applying the * operator.

impl<'_> Mul<Rational> for &'_ u16[src]

type Output = Rational

The resulting type after applying the * operator.

impl Mul<Rational> for u32[src]

type Output = Rational

The resulting type after applying the * operator.

impl<'_> Mul<Rational> for &'_ u32[src]

type Output = Rational

The resulting type after applying the * operator.

impl Mul<Rational> for Integer[src]

type Output = Rational

The resulting type after applying the * operator.

impl Mul<Rational> for u64[src]

type Output = Rational

The resulting type after applying the * operator.

impl<'_> Mul<Rational> for &'_ u64[src]

type Output = Rational

The resulting type after applying the * operator.

impl Mul<Rational> for u128[src]

type Output = Rational

The resulting type after applying the * operator.

impl<'_> Mul<Rational> for &'_ u128[src]

type Output = Rational

The resulting type after applying the * operator.

impl Mul<Rational> for Float[src]

type Output = Float

The resulting type after applying the * operator.

impl<'a> Mul<Rational> for &'a Float[src]

type Output = MulOwnedRationalIncomplete<'a>

The resulting type after applying the * operator.

impl Mul<Rational> for Complex[src]

type Output = Complex

The resulting type after applying the * operator.

impl<'a> Mul<Rational> for &'a Complex[src]

type Output = MulOwnedRationalIncomplete<'a>

The resulting type after applying the * operator.

impl<'_> Mul<Rational> for &'_ Integer[src]

type Output = Rational

The resulting type after applying the * operator.

impl Mul<Rational> for i8[src]

type Output = Rational

The resulting type after applying the * operator.

impl<'_> Mul<Rational> for &'_ i8[src]

type Output = Rational

The resulting type after applying the * operator.

impl Mul<Rational> for i16[src]

type Output = Rational

The resulting type after applying the * operator.

impl<'_> Mul<Rational> for &'_ i16[src]

type Output = Rational

The resulting type after applying the * operator.

impl Mul<Rational> for i32[src]

type Output = Rational

The resulting type after applying the * operator.

impl<'_> Mul<Rational> for &'_ i32[src]

type Output = Rational

The resulting type after applying the * operator.

impl Mul<i128> for Rational[src]

type Output = Rational

The resulting type after applying the * operator.

impl<'b> Mul<i128> for &'b Rational[src]

type Output = MulI128Incomplete<'b>

The resulting type after applying the * operator.

impl Mul<i16> for Rational[src]

type Output = Rational

The resulting type after applying the * operator.

impl<'b> Mul<i16> for &'b Rational[src]

type Output = MulI16Incomplete<'b>

The resulting type after applying the * operator.

impl Mul<i32> for Rational[src]

type Output = Rational

The resulting type after applying the * operator.

impl<'b> Mul<i32> for &'b Rational[src]

type Output = MulI32Incomplete<'b>

The resulting type after applying the * operator.

impl Mul<i64> for Rational[src]

type Output = Rational

The resulting type after applying the * operator.

impl<'b> Mul<i64> for &'b Rational[src]

type Output = MulI64Incomplete<'b>

The resulting type after applying the * operator.

impl Mul<i8> for Rational[src]

type Output = Rational

The resulting type after applying the * operator.

impl<'b> Mul<i8> for &'b Rational[src]

type Output = MulI8Incomplete<'b>

The resulting type after applying the * operator.

impl Mul<u128> for Rational[src]

type Output = Rational

The resulting type after applying the * operator.

impl<'b> Mul<u128> for &'b Rational[src]

type Output = MulU128Incomplete<'b>

The resulting type after applying the * operator.

impl Mul<u16> for Rational[src]

type Output = Rational

The resulting type after applying the * operator.

impl<'b> Mul<u16> for &'b Rational[src]

type Output = MulU16Incomplete<'b>

The resulting type after applying the * operator.

impl Mul<u32> for Rational[src]

type Output = Rational

The resulting type after applying the * operator.

impl<'b> Mul<u32> for &'b Rational[src]

type Output = MulU32Incomplete<'b>

The resulting type after applying the * operator.

impl Mul<u64> for Rational[src]

type Output = Rational

The resulting type after applying the * operator.

impl<'b> Mul<u64> for &'b Rational[src]

type Output = MulU64Incomplete<'b>

The resulting type after applying the * operator.

impl Mul<u8> for Rational[src]

type Output = Rational

The resulting type after applying the * operator.

impl<'b> Mul<u8> for &'b Rational[src]

type Output = MulU8Incomplete<'b>

The resulting type after applying the * operator.

impl<'_> MulAssign<&'_ Integer> for Rational[src]

impl<'_> MulAssign<&'_ Rational> for Rational[src]

impl<'_> MulAssign<&'_ Rational> for Float[src]

impl<'_> MulAssign<&'_ Rational> for Complex[src]

impl<'_> MulAssign<&'_ i128> for Rational[src]

impl<'_> MulAssign<&'_ i16> for Rational[src]

impl<'_> MulAssign<&'_ i32> for Rational[src]

impl<'_> MulAssign<&'_ i64> for Rational[src]

impl<'_> MulAssign<&'_ i8> for Rational[src]

impl<'_> MulAssign<&'_ u128> for Rational[src]

impl<'_> MulAssign<&'_ u16> for Rational[src]

impl<'_> MulAssign<&'_ u32> for Rational[src]

impl<'_> MulAssign<&'_ u64> for Rational[src]

impl<'_> MulAssign<&'_ u8> for Rational[src]

impl MulAssign<Integer> for Rational[src]

impl MulAssign<Rational> for Rational[src]

impl MulAssign<Rational> for Float[src]

impl MulAssign<Rational> for Complex[src]

impl MulAssign<i128> for Rational[src]

impl MulAssign<i16> for Rational[src]

impl MulAssign<i32> for Rational[src]

impl MulAssign<i64> for Rational[src]

impl MulAssign<i8> for Rational[src]

impl MulAssign<u128> for Rational[src]

impl MulAssign<u16> for Rational[src]

impl MulAssign<u32> for Rational[src]

impl MulAssign<u64> for Rational[src]

impl MulAssign<u8> for Rational[src]

impl<'_> MulAssignRound<&'_ Rational> for Float[src]

type Round = Round

The rounding method.

type Ordering = Ordering

The direction from rounding.

impl<'_> MulAssignRound<&'_ Rational> for Complex[src]

type Round = (Round, Round)

The rounding method.

type Ordering = (Ordering, Ordering)

The direction from rounding.

impl MulAssignRound<Rational> for Float[src]

type Round = Round

The rounding method.

type Ordering = Ordering

The direction from rounding.

impl MulAssignRound<Rational> for Complex[src]

type Round = (Round, Round)

The rounding method.

type Ordering = (Ordering, Ordering)

The direction from rounding.

impl<'_> MulFrom<&'_ Integer> for Rational[src]

impl<'_> MulFrom<&'_ Rational> for Rational[src]

impl<'_> MulFrom<&'_