#[repr(transparent)]pub struct Rational { /* private fields */ }
Expand description
Multiple precision rational value.
Implementations§
source§impl Rational
impl Rational
sourcepub fn add_integer(&self, other: &Integer) -> Self
pub fn add_integer(&self, other: &Integer) -> Self
Add a rational value and an integer value and return the rational result.
sourcepub fn add_assign(&mut self, other: &Self)
pub fn add_assign(&mut self, other: &Self)
Add two rationals and assign the result to self.
sourcepub fn add_assign_integer(&mut self, other: &Integer)
pub fn add_assign_integer(&mut self, other: &Integer)
Add a rational value and an integer value and assign the result to self.
sourcepub fn subtract(&self, other: &Self) -> Self
pub fn subtract(&self, other: &Self) -> Self
Subtract two rational values and return the result.
sourcepub fn subtract_integer(&self, other: &Integer) -> Self
pub fn subtract_integer(&self, other: &Integer) -> Self
Subtract a rational value and an integer value and return the rational result.
sourcepub fn subtract_assign(&mut self, other: &Self)
pub fn subtract_assign(&mut self, other: &Self)
Subtract two rationals and assign the result to self.
sourcepub fn subtract_assign_integer(&mut self, other: &Integer)
pub fn subtract_assign_integer(&mut self, other: &Integer)
Subtract a rational value and an integer value and assign the result to self.
sourcepub fn multiply(&self, other: &Self) -> Self
pub fn multiply(&self, other: &Self) -> Self
Multiply two rational values and return the result.
sourcepub fn multiply_integer(&self, other: &Integer) -> Self
pub fn multiply_integer(&self, other: &Integer) -> Self
Multiply a rational value and an integer value and return the rational result.
sourcepub fn multiply_assign(&mut self, other: &Self)
pub fn multiply_assign(&mut self, other: &Self)
Multiply two rationals and assign the result to self.
sourcepub fn multiply_assign_integer(&mut self, other: &Integer)
pub fn multiply_assign_integer(&mut self, other: &Integer)
Multiply a rational value and an integer value and assign the result to self.
sourcepub fn divide_integer(&self, other: &Integer) -> Self
pub fn divide_integer(&self, other: &Integer) -> Self
Divide a rational value and an integer value and return the rational result.
sourcepub fn divide_assign(&mut self, other: &Self)
pub fn divide_assign(&mut self, other: &Self)
Divide two rationals and assign the result to self.
sourcepub fn divide_assign_integer(&mut self, other: &Integer)
pub fn divide_assign_integer(&mut self, other: &Integer)
Divide a rational value and an integer value and assign the result to self.
sourcepub fn absolute_value(&self) -> Self
pub fn absolute_value(&self) -> Self
Return the absolute value
sourcepub fn absolute_value_assign(&mut self)
pub fn absolute_value_assign(&mut self)
Assign the absolute value to self
sourcepub fn negate_assign(&mut self)
pub fn negate_assign(&mut self)
Assign the additive inverse to self
sourcepub fn reciprocal(&self) -> Self
pub fn reciprocal(&self) -> Self
Return the multiplicative inverse
sourcepub fn reciprocal_assign(&mut self)
pub fn reciprocal_assign(&mut self)
Assign the multiplicative inverse to self
source§impl Rational
impl Rational
sourcepub fn new() -> Self
pub fn new() -> Self
Create a new rational with a default value of zero (0/1).
Example
use reckoner::Rational;
let r = Rational::new();
assert_eq!(r, (0, 1));
sourcepub unsafe fn from_raw(raw: *mut mpq_t) -> Self
pub unsafe fn from_raw(raw: *mut mpq_t) -> Self
Construct a Rational from a raw non-null pointer to
creachadair_imath_sys::mpq_t
.
Safety
This function must only every be called once for a given pointer, and
the pointer must point to an initialized creachadair_imath_sys::mpq_t
struct. The recommendation is to only use raw pointers from the
Rational::into_raw
function.
In ths context, initialized means that the
creachadair_imath_sys::mpq_t
has been the argument of a call to
creachadair_imath_sys::mp_rat_init
.
Example
use creachadair_imath_sys::{mp_rat_zero, MP_OK};
use reckoner::Rational;
let a = Rational::from((456, 123));
assert_eq!(a, (456, 123));
let a_raw = Rational::into_raw(a);
unsafe { mp_rat_zero(a_raw) };
let a = unsafe { Rational::from_raw(a_raw) };
assert_eq!(a, (0, 1));
sourcepub fn into_raw(rational: Rational) -> *mut mpq_t
pub fn into_raw(rational: Rational) -> *mut mpq_t
Consumes the Rational, returning a wrapped raw pointer.
Example
use creachadair_imath_sys::{mp_rat_add, MP_OK};
use reckoner::Rational;
let a = Rational::from((377, 500));
let b = Rational::from((123, 500));
let c = Rational::new();
let a_raw = Rational::into_raw(a);
let b_raw = Rational::into_raw(b);
let c_raw = Rational::into_raw(c);
let op_res = unsafe { mp_rat_add(a_raw, b_raw, c_raw) };
if op_res != unsafe { MP_OK } {
panic!("Operation failed.")
}
let a = unsafe { Rational::from_raw(a_raw) };
let b = unsafe { Rational::from_raw(b_raw) };
let c = unsafe { Rational::from_raw(c_raw) };
assert_eq!(a, (377, 500));
assert_eq!(b, (123, 500));
assert_eq!(c, (500, 500));
sourcepub fn reduce(&mut self)
pub fn reduce(&mut self)
Reduces r
in-place to lowest terms and canonical form.
Zero is represented as 0/1, one as 1/1, and signs are adjusted so that the sign of the value is carried by the numerator.
Example
use reckoner::Rational;
let mut a = Rational::from((24, 2));
let mut b = Rational::from((24, 3));
let mut c = Rational::from((24, 4));
a.reduce();
b.reduce();
c.reduce();
assert_eq!(a, (12, 1));
assert_eq!(b, (8, 1));
assert_eq!(c, (6, 1));
sourcepub fn zero(&mut self)
pub fn zero(&mut self)
Set value of integer to zero
Example
use reckoner::Rational;
let mut r = Rational::from((1234567u128, 1346172348u64));
r.zero();
assert_eq!(r, (0, 1));
sourcepub fn is_integer(&self) -> bool
pub fn is_integer(&self) -> bool
Returns true if the denominator is 1.
Example
use reckoner::Rational;
assert!(Rational::from((0, 1)).is_integer());
assert!(Rational::from((1, 1)).is_integer());
assert!(!Rational::from((3, 25)).is_integer());
sourcepub fn compare(&self, rhs: &Self) -> Ordering
pub fn compare(&self, rhs: &Self) -> Ordering
Compare two rationals
Example
use core::cmp::Ordering;
use reckoner::Rational;
let a = Rational::from((123, 500));
let b = Rational::from((377, 500));
assert_eq!(a.compare(&b), Ordering::Less);
assert_eq!(b.compare(&a), Ordering::Greater);
assert_eq!(a.compare(&a), Ordering::Equal);
sourcepub fn compare_magnitude(&self, rhs: &Self) -> Ordering
pub fn compare_magnitude(&self, rhs: &Self) -> Ordering
Compare the magnitude of two rationals, not taking sign into account.
Example
use core::cmp::Ordering;
use reckoner::Rational;
let a = Rational::from((123, 500));
let b = Rational::from((-377, 500));
assert_eq!(a.compare(&b), Ordering::Greater);
assert_eq!(a.compare_magnitude(&b), Ordering::Less);
sourcepub fn compare_zero(&self) -> Ordering
pub fn compare_zero(&self) -> Ordering
Compare a rational to zero.
Example
use core::cmp::Ordering;
use reckoner::Rational;
let a = Rational::from((123, 500));
let b = Rational::from((-377, 500));
assert_eq!(a.compare_zero(), Ordering::Greater);
assert_eq!(b.compare_zero(), Ordering::Less);
sourcepub fn numerator(&self) -> Integer
pub fn numerator(&self) -> Integer
Return a copy of the numerator of the rational value
Example
use reckoner::Rational;
let a = Rational::from((34256, 54587));
assert_eq!(a.numerator(), 34256);
sourcepub fn denominator(&self) -> Integer
pub fn denominator(&self) -> Integer
Return a copy of the denominator of the rational value
Example
use reckoner::Rational;
let a = Rational::from((34256, 54587));
assert_eq!(a.denominator(), 54587);
sourcepub fn copy_to(&self, other: &mut Self)
pub fn copy_to(&self, other: &mut Self)
Replaces the value of other
with a copy of the value of self
. No new
memory is allocated unless self
has more significant digits than
other
has allocated.
Example
use reckoner::Rational;
let a = Rational::from((34256, 54587));
let mut b = Rational::new();
a.copy_to(&mut b);
assert_eq!(a, b);
assert_eq!(b, (34256, 54587));
sourcepub fn to_decimal(&self, rounding_mode: RoundMode, max_precision: u16) -> String
pub fn to_decimal(&self, rounding_mode: RoundMode, max_precision: u16) -> String
Converts the value of self
to a string in base-10 decimal-point
notation. It generates max_precision
digits of precision and takes a
RoundMode
argument that determines how the ratio will be converted to
decimal.
Example
use reckoner::{Rational, RoundMode};
let r = Rational::from((1146408, 364913));
assert_eq!(r.to_decimal(RoundMode::HalfUp, 6), "3.141593");
assert_eq!(r.to_decimal(RoundMode::HalfUp, 5), "3.14159");
assert_eq!(r.to_decimal(RoundMode::HalfUp, 4), "3.1416");
assert_eq!(r.to_decimal(RoundMode::HalfUp, 3), "3.142");
Trait Implementations§
source§impl AddAssign<&Integer> for Rational
impl AddAssign<&Integer> for Rational
source§fn add_assign(&mut self, rhs: &Integer)
fn add_assign(&mut self, rhs: &Integer)
+=
operation. Read moresource§impl AddAssign<&Rational> for Rational
impl AddAssign<&Rational> for Rational
source§fn add_assign(&mut self, rhs: &Rational)
fn add_assign(&mut self, rhs: &Rational)
+=
operation. Read moresource§impl AddAssign<&i128> for Rational
impl AddAssign<&i128> for Rational
source§fn add_assign(&mut self, rhs: &i128)
fn add_assign(&mut self, rhs: &i128)
+=
operation. Read moresource§impl AddAssign<&i16> for Rational
impl AddAssign<&i16> for Rational
source§fn add_assign(&mut self, rhs: &i16)
fn add_assign(&mut self, rhs: &i16)
+=
operation. Read moresource§impl AddAssign<&i32> for Rational
impl AddAssign<&i32> for Rational
source§fn add_assign(&mut self, rhs: &i32)
fn add_assign(&mut self, rhs: &i32)
+=
operation. Read moresource§impl AddAssign<&i64> for Rational
impl AddAssign<&i64> for Rational
source§fn add_assign(&mut self, rhs: &i64)
fn add_assign(&mut self, rhs: &i64)
+=
operation. Read moresource§impl AddAssign<&i8> for Rational
impl AddAssign<&i8> for Rational
source§fn add_assign(&mut self, rhs: &i8)
fn add_assign(&mut self, rhs: &i8)
+=
operation. Read moresource§impl AddAssign<&u128> for Rational
impl AddAssign<&u128> for Rational
source§fn add_assign(&mut self, rhs: &u128)
fn add_assign(&mut self, rhs: &u128)
+=
operation. Read moresource§impl AddAssign<&u16> for Rational
impl AddAssign<&u16> for Rational
source§fn add_assign(&mut self, rhs: &u16)
fn add_assign(&mut self, rhs: &u16)
+=
operation. Read moresource§impl AddAssign<&u32> for Rational
impl AddAssign<&u32> for Rational
source§fn add_assign(&mut self, rhs: &u32)
fn add_assign(&mut self, rhs: &u32)
+=
operation. Read moresource§impl AddAssign<&u64> for Rational
impl AddAssign<&u64> for Rational
source§fn add_assign(&mut self, rhs: &u64)
fn add_assign(&mut self, rhs: &u64)
+=
operation. Read moresource§impl AddAssign<&u8> for Rational
impl AddAssign<&u8> for Rational
source§fn add_assign(&mut self, rhs: &u8)
fn add_assign(&mut self, rhs: &u8)
+=
operation. Read moresource§impl AddAssign<Integer> for Rational
impl AddAssign<Integer> for Rational
source§fn add_assign(&mut self, rhs: Integer)
fn add_assign(&mut self, rhs: Integer)
+=
operation. Read moresource§impl AddAssign<Rational> for Rational
impl AddAssign<Rational> for Rational
source§fn add_assign(&mut self, rhs: Rational)
fn add_assign(&mut self, rhs: Rational)
+=
operation. Read moresource§impl AddAssign<i128> for Rational
impl AddAssign<i128> for Rational
source§fn add_assign(&mut self, rhs: i128)
fn add_assign(&mut self, rhs: i128)
+=
operation. Read moresource§impl AddAssign<i16> for Rational
impl AddAssign<i16> for Rational
source§fn add_assign(&mut self, rhs: i16)
fn add_assign(&mut self, rhs: i16)
+=
operation. Read moresource§impl AddAssign<i32> for Rational
impl AddAssign<i32> for Rational
source§fn add_assign(&mut self, rhs: i32)
fn add_assign(&mut self, rhs: i32)
+=
operation. Read moresource§impl AddAssign<i64> for Rational
impl AddAssign<i64> for Rational
source§fn add_assign(&mut self, rhs: i64)
fn add_assign(&mut self, rhs: i64)
+=
operation. Read moresource§impl AddAssign<i8> for Rational
impl AddAssign<i8> for Rational
source§fn add_assign(&mut self, rhs: i8)
fn add_assign(&mut self, rhs: i8)
+=
operation. Read moresource§impl AddAssign<u128> for Rational
impl AddAssign<u128> for Rational
source§fn add_assign(&mut self, rhs: u128)
fn add_assign(&mut self, rhs: u128)
+=
operation. Read moresource§impl AddAssign<u16> for Rational
impl AddAssign<u16> for Rational
source§fn add_assign(&mut self, rhs: u16)
fn add_assign(&mut self, rhs: u16)
+=
operation. Read moresource§impl AddAssign<u32> for Rational
impl AddAssign<u32> for Rational
source§fn add_assign(&mut self, rhs: u32)
fn add_assign(&mut self, rhs: u32)
+=
operation. Read moresource§impl AddAssign<u64> for Rational
impl AddAssign<u64> for Rational
source§fn add_assign(&mut self, rhs: u64)
fn add_assign(&mut self, rhs: u64)
+=
operation. Read moresource§impl AddAssign<u8> for Rational
impl AddAssign<u8> for Rational
source§fn add_assign(&mut self, rhs: u8)
fn add_assign(&mut self, rhs: u8)
+=
operation. Read moresource§impl DivAssign<&Integer> for Rational
impl DivAssign<&Integer> for Rational
source§fn div_assign(&mut self, rhs: &Integer)
fn div_assign(&mut self, rhs: &Integer)
/=
operation. Read moresource§impl DivAssign<&Rational> for Rational
impl DivAssign<&Rational> for Rational
source§fn div_assign(&mut self, rhs: &Rational)
fn div_assign(&mut self, rhs: &Rational)
/=
operation. Read moresource§impl DivAssign<&i128> for Rational
impl DivAssign<&i128> for Rational
source§fn div_assign(&mut self, rhs: &i128)
fn div_assign(&mut self, rhs: &i128)
/=
operation. Read moresource§impl DivAssign<&i16> for Rational
impl DivAssign<&i16> for Rational
source§fn div_assign(&mut self, rhs: &i16)
fn div_assign(&mut self, rhs: &i16)
/=
operation. Read moresource§impl DivAssign<&i32> for Rational
impl DivAssign<&i32> for Rational
source§fn div_assign(&mut self, rhs: &i32)
fn div_assign(&mut self, rhs: &i32)
/=
operation. Read moresource§impl DivAssign<&i64> for Rational
impl DivAssign<&i64> for Rational
source§fn div_assign(&mut self, rhs: &i64)
fn div_assign(&mut self, rhs: &i64)
/=
operation. Read moresource§impl DivAssign<&i8> for Rational
impl DivAssign<&i8> for Rational
source§fn div_assign(&mut self, rhs: &i8)
fn div_assign(&mut self, rhs: &i8)
/=
operation. Read moresource§impl DivAssign<&u128> for Rational
impl DivAssign<&u128> for Rational
source§fn div_assign(&mut self, rhs: &u128)
fn div_assign(&mut self, rhs: &u128)
/=
operation. Read moresource§impl DivAssign<&u16> for Rational
impl DivAssign<&u16> for Rational
source§fn div_assign(&mut self, rhs: &u16)
fn div_assign(&mut self, rhs: &u16)
/=
operation. Read moresource§impl DivAssign<&u32> for Rational
impl DivAssign<&u32> for Rational
source§fn div_assign(&mut self, rhs: &u32)
fn div_assign(&mut self, rhs: &u32)
/=
operation. Read moresource§impl DivAssign<&u64> for Rational
impl DivAssign<&u64> for Rational
source§fn div_assign(&mut self, rhs: &u64)
fn div_assign(&mut self, rhs: &u64)
/=
operation. Read moresource§impl DivAssign<&u8> for Rational
impl DivAssign<&u8> for Rational
source§fn div_assign(&mut self, rhs: &u8)
fn div_assign(&mut self, rhs: &u8)
/=
operation. Read moresource§impl DivAssign<Integer> for Rational
impl DivAssign<Integer> for Rational
source§fn div_assign(&mut self, rhs: Integer)
fn div_assign(&mut self, rhs: Integer)
/=
operation. Read moresource§impl DivAssign<Rational> for Rational
impl DivAssign<Rational> for Rational
source§fn div_assign(&mut self, rhs: Rational)
fn div_assign(&mut self, rhs: Rational)
/=
operation. Read moresource§impl DivAssign<i128> for Rational
impl DivAssign<i128> for Rational
source§fn div_assign(&mut self, rhs: i128)
fn div_assign(&mut self, rhs: i128)
/=
operation. Read moresource§impl DivAssign<i16> for Rational
impl DivAssign<i16> for Rational
source§fn div_assign(&mut self, rhs: i16)
fn div_assign(&mut self, rhs: i16)
/=
operation. Read moresource§impl DivAssign<i32> for Rational
impl DivAssign<i32> for Rational
source§fn div_assign(&mut self, rhs: i32)
fn div_assign(&mut self, rhs: i32)
/=
operation. Read moresource§impl DivAssign<i64> for Rational
impl DivAssign<i64> for Rational
source§fn div_assign(&mut self, rhs: i64)
fn div_assign(&mut self, rhs: i64)
/=
operation. Read moresource§impl DivAssign<i8> for Rational
impl DivAssign<i8> for Rational
source§fn div_assign(&mut self, rhs: i8)
fn div_assign(&mut self, rhs: i8)
/=
operation. Read moresource§impl DivAssign<u128> for Rational
impl DivAssign<u128> for Rational
source§fn div_assign(&mut self, rhs: u128)
fn div_assign(&mut self, rhs: u128)
/=
operation. Read moresource§impl DivAssign<u16> for Rational
impl DivAssign<u16> for Rational
source§fn div_assign(&mut self, rhs: u16)
fn div_assign(&mut self, rhs: u16)
/=
operation. Read moresource§impl DivAssign<u32> for Rational
impl DivAssign<u32> for Rational
source§fn div_assign(&mut self, rhs: u32)
fn div_assign(&mut self, rhs: u32)
/=
operation. Read moresource§impl DivAssign<u64> for Rational
impl DivAssign<u64> for Rational
source§fn div_assign(&mut self, rhs: u64)
fn div_assign(&mut self, rhs: u64)
/=
operation. Read moresource§impl DivAssign<u8> for Rational
impl DivAssign<u8> for Rational
source§fn div_assign(&mut self, rhs: u8)
fn div_assign(&mut self, rhs: u8)
/=
operation. Read moresource§impl<'a, A, B> From<&'a (A, B)> for Rationalwhere
&'a A: Into<Integer>,
&'a B: Into<Integer>,
impl<'a, A, B> From<&'a (A, B)> for Rationalwhere &'a A: Into<Integer>, &'a B: Into<Integer>,
source§impl FromStr for Rational
impl FromStr for Rational
Parse a rational value from a string having one of the following formats, each with an optional leading sign flag:
n
, integer format, e.g. “123”n/d
, ratio format, e.g., “-12/5”z.ffff
, decimal format, e.g., “1.627”
After successfully parsing, the rational will be reduced by factoring out
common multiples of the numerator and denominators, as if Rational::reduce
was called on the value.
source§impl MulAssign<&Integer> for Rational
impl MulAssign<&Integer> for Rational
source§fn mul_assign(&mut self, rhs: &Integer)
fn mul_assign(&mut self, rhs: &Integer)
*=
operation. Read moresource§impl MulAssign<&Rational> for Rational
impl MulAssign<&Rational> for Rational
source§fn mul_assign(&mut self, rhs: &Rational)
fn mul_assign(&mut self, rhs: &Rational)
*=
operation. Read moresource§impl MulAssign<&i128> for Rational
impl MulAssign<&i128> for Rational
source§fn mul_assign(&mut self, rhs: &i128)
fn mul_assign(&mut self, rhs: &i128)
*=
operation. Read moresource§impl MulAssign<&i16> for Rational
impl MulAssign<&i16> for Rational
source§fn mul_assign(&mut self, rhs: &i16)
fn mul_assign(&mut self, rhs: &i16)
*=
operation. Read moresource§impl MulAssign<&i32> for Rational
impl MulAssign<&i32> for Rational
source§fn mul_assign(&mut self, rhs: &i32)
fn mul_assign(&mut self, rhs: &i32)
*=
operation. Read moresource§impl MulAssign<&i64> for Rational
impl MulAssign<&i64> for Rational
source§fn mul_assign(&mut self, rhs: &i64)
fn mul_assign(&mut self, rhs: &i64)
*=
operation. Read moresource§impl MulAssign<&i8> for Rational
impl MulAssign<&i8> for Rational
source§fn mul_assign(&mut self, rhs: &i8)
fn mul_assign(&mut self, rhs: &i8)
*=
operation. Read moresource§impl MulAssign<&u128> for Rational
impl MulAssign<&u128> for Rational
source§fn mul_assign(&mut self, rhs: &u128)
fn mul_assign(&mut self, rhs: &u128)
*=
operation. Read moresource§impl MulAssign<&u16> for Rational
impl MulAssign<&u16> for Rational
source§fn mul_assign(&mut self, rhs: &u16)
fn mul_assign(&mut self, rhs: &u16)
*=
operation. Read moresource§impl MulAssign<&u32> for Rational
impl MulAssign<&u32> for Rational
source§fn mul_assign(&mut self, rhs: &u32)
fn mul_assign(&mut self, rhs: &u32)
*=
operation. Read moresource§impl MulAssign<&u64> for Rational
impl MulAssign<&u64> for Rational
source§fn mul_assign(&mut self, rhs: &u64)
fn mul_assign(&mut self, rhs: &u64)
*=
operation. Read moresource§impl MulAssign<&u8> for Rational
impl MulAssign<&u8> for Rational
source§fn mul_assign(&mut self, rhs: &u8)
fn mul_assign(&mut self, rhs: &u8)
*=
operation. Read moresource§impl MulAssign<Integer> for Rational
impl MulAssign<Integer> for Rational
source§fn mul_assign(&mut self, rhs: Integer)
fn mul_assign(&mut self, rhs: Integer)
*=
operation. Read moresource§impl MulAssign<Rational> for Rational
impl MulAssign<Rational> for Rational
source§fn mul_assign(&mut self, rhs: Rational)
fn mul_assign(&mut self, rhs: Rational)
*=
operation. Read moresource§impl MulAssign<i128> for Rational
impl MulAssign<i128> for Rational
source§fn mul_assign(&mut self, rhs: i128)
fn mul_assign(&mut self, rhs: i128)
*=
operation. Read moresource§impl MulAssign<i16> for Rational
impl MulAssign<i16> for Rational
source§fn mul_assign(&mut self, rhs: i16)
fn mul_assign(&mut self, rhs: i16)
*=
operation. Read moresource§impl MulAssign<i32> for Rational
impl MulAssign<i32> for Rational
source§fn mul_assign(&mut self, rhs: i32)
fn mul_assign(&mut self, rhs: i32)
*=
operation. Read moresource§impl MulAssign<i64> for Rational
impl MulAssign<i64> for Rational
source§fn mul_assign(&mut self, rhs: i64)
fn mul_assign(&mut self, rhs: i64)
*=
operation. Read moresource§impl MulAssign<i8> for Rational
impl MulAssign<i8> for Rational
source§fn mul_assign(&mut self, rhs: i8)
fn mul_assign(&mut self, rhs: i8)
*=
operation. Read moresource§impl MulAssign<u128> for Rational
impl MulAssign<u128> for Rational
source§fn mul_assign(&mut self, rhs: u128)
fn mul_assign(&mut self, rhs: u128)
*=
operation. Read moresource§impl MulAssign<u16> for Rational
impl MulAssign<u16> for Rational
source§fn mul_assign(&mut self, rhs: u16)
fn mul_assign(&mut self, rhs: u16)
*=
operation. Read moresource§impl MulAssign<u32> for Rational
impl MulAssign<u32> for Rational
source§fn mul_assign(&mut self, rhs: u32)
fn mul_assign(&mut self, rhs: u32)
*=
operation. Read moresource§impl MulAssign<u64> for Rational
impl MulAssign<u64> for Rational
source§fn mul_assign(&mut self, rhs: u64)
fn mul_assign(&mut self, rhs: u64)
*=
operation. Read moresource§impl MulAssign<u8> for Rational
impl MulAssign<u8> for Rational
source§fn mul_assign(&mut self, rhs: u8)
fn mul_assign(&mut self, rhs: u8)
*=
operation. Read moresource§impl Ord for Rational
impl Ord for Rational
source§impl PartialEq<(Integer, Integer)> for Rational
impl PartialEq<(Integer, Integer)> for Rational
source§impl PartialEq<(i128, i128)> for Rational
impl PartialEq<(i128, i128)> for Rational
source§impl PartialEq<(i16, i16)> for Rational
impl PartialEq<(i16, i16)> for Rational
source§impl PartialEq<(i32, i32)> for Rational
impl PartialEq<(i32, i32)> for Rational
source§impl PartialEq<(i64, i64)> for Rational
impl PartialEq<(i64, i64)> for Rational
source§impl PartialEq<(i8, i8)> for Rational
impl PartialEq<(i8, i8)> for Rational
source§impl PartialEq<(u128, u128)> for Rational
impl PartialEq<(u128, u128)> for Rational
source§impl PartialEq<(u16, u16)> for Rational
impl PartialEq<(u16, u16)> for Rational
source§impl PartialEq<(u32, u32)> for Rational
impl PartialEq<(u32, u32)> for Rational
source§impl PartialEq<(u64, u64)> for Rational
impl PartialEq<(u64, u64)> for Rational
source§impl PartialEq<(u8, u8)> for Rational
impl PartialEq<(u8, u8)> for Rational
source§impl PartialEq<Integer> for Rational
impl PartialEq<Integer> for Rational
source§impl PartialEq<Rational> for (Integer, Integer)
impl PartialEq<Rational> for (Integer, Integer)
source§impl PartialEq<Rational> for (i128, i128)
impl PartialEq<Rational> for (i128, i128)
source§impl PartialEq<Rational> for (i16, i16)
impl PartialEq<Rational> for (i16, i16)
source§impl PartialEq<Rational> for (i32, i32)
impl PartialEq<Rational> for (i32, i32)
source§impl PartialEq<Rational> for (i64, i64)
impl PartialEq<Rational> for (i64, i64)
source§impl PartialEq<Rational> for (i8, i8)
impl PartialEq<Rational> for (i8, i8)
source§impl PartialEq<Rational> for (u128, u128)
impl PartialEq<Rational> for (u128, u128)
source§impl PartialEq<Rational> for (u16, u16)
impl PartialEq<Rational> for (u16, u16)
source§impl PartialEq<Rational> for (u32, u32)
impl PartialEq<Rational> for (u32, u32)
source§impl PartialEq<Rational> for (u64, u64)
impl PartialEq<Rational> for (u64, u64)
source§impl PartialEq<Rational> for (u8, u8)
impl PartialEq<Rational> for (u8, u8)
source§impl PartialEq<Rational> for Integer
impl PartialEq<Rational> for Integer
source§impl PartialEq<Rational> for Rational
impl PartialEq<Rational> for Rational
source§impl PartialEq<Rational> for i128
impl PartialEq<Rational> for i128
source§impl PartialEq<Rational> for i16
impl PartialEq<Rational> for i16
source§impl PartialEq<Rational> for i32
impl PartialEq<Rational> for i32
source§impl PartialEq<Rational> for i64
impl PartialEq<Rational> for i64
source§impl PartialEq<Rational> for i8
impl PartialEq<Rational> for i8
source§impl PartialEq<Rational> for u128
impl PartialEq<Rational> for u128
source§impl PartialEq<Rational> for u16
impl PartialEq<Rational> for u16
source§impl PartialEq<Rational> for u32
impl PartialEq<Rational> for u32
source§impl PartialEq<Rational> for u64
impl PartialEq<Rational> for u64
source§impl PartialEq<Rational> for u8
impl PartialEq<Rational> for u8
source§impl PartialEq<i128> for Rational
impl PartialEq<i128> for Rational
source§impl PartialEq<u128> for Rational
impl PartialEq<u128> for Rational
source§impl PartialOrd<(Integer, Integer)> for Rational
impl PartialOrd<(Integer, Integer)> for Rational
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read moresource§impl PartialOrd<(i128, i128)> for Rational
impl PartialOrd<(i128, i128)> for Rational
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read moresource§impl PartialOrd<(i16, i16)> for Rational
impl PartialOrd<(i16, i16)> for Rational
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read moresource§impl PartialOrd<(i32, i32)> for Rational
impl PartialOrd<(i32, i32)> for Rational
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read moresource§impl PartialOrd<(i64, i64)> for Rational
impl PartialOrd<(i64, i64)> for Rational
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read moresource§impl PartialOrd<(i8, i8)> for Rational
impl PartialOrd<(i8, i8)> for Rational
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read moresource§impl PartialOrd<(u128, u128)> for Rational
impl PartialOrd<(u128, u128)> for Rational
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read moresource§impl PartialOrd<(u16, u16)> for Rational
impl PartialOrd<(u16, u16)> for Rational
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read moresource§impl PartialOrd<(u32, u32)> for Rational
impl PartialOrd<(u32, u32)> for Rational
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read moresource§impl PartialOrd<(u64, u64)> for Rational
impl PartialOrd<(u64, u64)> for Rational
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read moresource§impl PartialOrd<(u8, u8)> for Rational
impl PartialOrd<(u8, u8)> for Rational
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read moresource§impl PartialOrd<Integer> for Rational
impl PartialOrd<Integer> for Rational
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read moresource§impl PartialOrd<Rational> for (Integer, Integer)
impl PartialOrd<Rational> for (Integer, Integer)
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read moresource§impl PartialOrd<Rational> for (i128, i128)
impl PartialOrd<Rational> for (i128, i128)
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read moresource§impl PartialOrd<Rational> for (i16, i16)
impl PartialOrd<Rational> for (i16, i16)
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read moresource§impl PartialOrd<Rational> for (i32, i32)
impl PartialOrd<Rational> for (i32, i32)
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read moresource§impl PartialOrd<Rational> for (i64, i64)
impl PartialOrd<Rational> for (i64, i64)
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read moresource§impl PartialOrd<Rational> for (i8, i8)
impl PartialOrd<Rational> for (i8, i8)
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read moresource§impl PartialOrd<Rational> for (u128, u128)
impl PartialOrd<Rational> for (u128, u128)
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read moresource§impl PartialOrd<Rational> for (u16, u16)
impl PartialOrd<Rational> for (u16, u16)
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read moresource§impl PartialOrd<Rational> for (u32, u32)
impl PartialOrd<Rational> for (u32, u32)
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read moresource§impl PartialOrd<Rational> for (u64, u64)
impl PartialOrd<Rational> for (u64, u64)
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read moresource§impl PartialOrd<Rational> for (u8, u8)
impl PartialOrd<Rational> for (u8, u8)
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read moresource§impl PartialOrd<Rational> for Integer
impl PartialOrd<Rational> for Integer
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read moresource§impl PartialOrd<Rational> for Rational
impl PartialOrd<Rational> for Rational
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read moresource§impl PartialOrd<Rational> for i128
impl PartialOrd<Rational> for i128
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read moresource§impl PartialOrd<Rational> for i16
impl PartialOrd<Rational> for i16
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read moresource§impl PartialOrd<Rational> for i32
impl PartialOrd<Rational> for i32
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read moresource§impl PartialOrd<Rational> for i64
impl PartialOrd<Rational> for i64
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read moresource§impl PartialOrd<Rational> for i8
impl PartialOrd<Rational> for i8
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read moresource§impl PartialOrd<Rational> for u128
impl PartialOrd<Rational> for u128
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read moresource§impl PartialOrd<Rational> for u16
impl PartialOrd<Rational> for u16
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read moresource§impl PartialOrd<Rational> for u32
impl PartialOrd<Rational> for u32
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read moresource§impl PartialOrd<Rational> for u64
impl PartialOrd<Rational> for u64
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read moresource§impl PartialOrd<Rational> for u8
impl PartialOrd<Rational> for u8
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read moresource§impl PartialOrd<i128> for Rational
impl PartialOrd<i128> for Rational
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read moresource§impl PartialOrd<i16> for Rational
impl PartialOrd<i16> for Rational
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read moresource§impl PartialOrd<i32> for Rational
impl PartialOrd<i32> for Rational
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read moresource§impl PartialOrd<i64> for Rational
impl PartialOrd<i64> for Rational
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read moresource§impl PartialOrd<i8> for Rational
impl PartialOrd<i8> for Rational
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read moresource§impl PartialOrd<u128> for Rational
impl PartialOrd<u128> for Rational
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read moresource§impl PartialOrd<u16> for Rational
impl PartialOrd<u16> for Rational
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read moresource§impl PartialOrd<u32> for Rational
impl PartialOrd<u32> for Rational
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read moresource§impl PartialOrd<u64> for Rational
impl PartialOrd<u64> for Rational
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read moresource§impl PartialOrd<u8> for Rational
impl PartialOrd<u8> for Rational
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read moresource§impl SubAssign<&Integer> for Rational
impl SubAssign<&Integer> for Rational
source§fn sub_assign(&mut self, rhs: &Integer)
fn sub_assign(&mut self, rhs: &Integer)
-=
operation. Read moresource§impl SubAssign<&Rational> for Rational
impl SubAssign<&Rational> for Rational
source§fn sub_assign(&mut self, rhs: &Rational)
fn sub_assign(&mut self, rhs: &Rational)
-=
operation. Read moresource§impl SubAssign<&i128> for Rational
impl SubAssign<&i128> for Rational
source§fn sub_assign(&mut self, rhs: &i128)
fn sub_assign(&mut self, rhs: &i128)
-=
operation. Read moresource§impl SubAssign<&i16> for Rational
impl SubAssign<&i16> for Rational
source§fn sub_assign(&mut self, rhs: &i16)
fn sub_assign(&mut self, rhs: &i16)
-=
operation. Read moresource§impl SubAssign<&i32> for Rational
impl SubAssign<&i32> for Rational
source§fn sub_assign(&mut self, rhs: &i32)
fn sub_assign(&mut self, rhs: &i32)
-=
operation. Read moresource§impl SubAssign<&i64> for Rational
impl SubAssign<&i64> for Rational
source§fn sub_assign(&mut self, rhs: &i64)
fn sub_assign(&mut self, rhs: &i64)
-=
operation. Read moresource§impl SubAssign<&i8> for Rational
impl SubAssign<&i8> for Rational
source§fn sub_assign(&mut self, rhs: &i8)
fn sub_assign(&mut self, rhs: &i8)
-=
operation. Read moresource§impl SubAssign<&u128> for Rational
impl SubAssign<&u128> for Rational
source§fn sub_assign(&mut self, rhs: &u128)
fn sub_assign(&mut self, rhs: &u128)
-=
operation. Read moresource§impl SubAssign<&u16> for Rational
impl SubAssign<&u16> for Rational
source§fn sub_assign(&mut self, rhs: &u16)
fn sub_assign(&mut self, rhs: &u16)
-=
operation. Read moresource§impl SubAssign<&u32> for Rational
impl SubAssign<&u32> for Rational
source§fn sub_assign(&mut self, rhs: &u32)
fn sub_assign(&mut self, rhs: &u32)
-=
operation. Read moresource§impl SubAssign<&u64> for Rational
impl SubAssign<&u64> for Rational
source§fn sub_assign(&mut self, rhs: &u64)
fn sub_assign(&mut self, rhs: &u64)
-=
operation. Read moresource§impl SubAssign<&u8> for Rational
impl SubAssign<&u8> for Rational
source§fn sub_assign(&mut self, rhs: &u8)
fn sub_assign(&mut self, rhs: &u8)
-=
operation. Read moresource§impl SubAssign<Integer> for Rational
impl SubAssign<Integer> for Rational
source§fn sub_assign(&mut self, rhs: Integer)
fn sub_assign(&mut self, rhs: Integer)
-=
operation. Read moresource§impl SubAssign<Rational> for Rational
impl SubAssign<Rational> for Rational
source§fn sub_assign(&mut self, rhs: Rational)
fn sub_assign(&mut self, rhs: Rational)
-=
operation. Read moresource§impl SubAssign<i128> for Rational
impl SubAssign<i128> for Rational
source§fn sub_assign(&mut self, rhs: i128)
fn sub_assign(&mut self, rhs: i128)
-=
operation. Read moresource§impl SubAssign<i16> for Rational
impl SubAssign<i16> for Rational
source§fn sub_assign(&mut self, rhs: i16)
fn sub_assign(&mut self, rhs: i16)
-=
operation. Read moresource§impl SubAssign<i32> for Rational
impl SubAssign<i32> for Rational
source§fn sub_assign(&mut self, rhs: i32)
fn sub_assign(&mut self, rhs: i32)
-=
operation. Read moresource§impl SubAssign<i64> for Rational
impl SubAssign<i64> for Rational
source§fn sub_assign(&mut self, rhs: i64)
fn sub_assign(&mut self, rhs: i64)
-=
operation. Read moresource§impl SubAssign<i8> for Rational
impl SubAssign<i8> for Rational
source§fn sub_assign(&mut self, rhs: i8)
fn sub_assign(&mut self, rhs: i8)
-=
operation. Read moresource§impl SubAssign<u128> for Rational
impl SubAssign<u128> for Rational
source§fn sub_assign(&mut self, rhs: u128)
fn sub_assign(&mut self, rhs: u128)
-=
operation. Read moresource§impl SubAssign<u16> for Rational
impl SubAssign<u16> for Rational
source§fn sub_assign(&mut self, rhs: u16)
fn sub_assign(&mut self, rhs: u16)
-=
operation. Read moresource§impl SubAssign<u32> for Rational
impl SubAssign<u32> for Rational
source§fn sub_assign(&mut self, rhs: u32)
fn sub_assign(&mut self, rhs: u32)
-=
operation. Read moresource§impl SubAssign<u64> for Rational
impl SubAssign<u64> for Rational
source§fn sub_assign(&mut self, rhs: u64)
fn sub_assign(&mut self, rhs: u64)
-=
operation. Read moresource§impl SubAssign<u8> for Rational
impl SubAssign<u8> for Rational
source§fn sub_assign(&mut self, rhs: u8)
fn sub_assign(&mut self, rhs: u8)
-=
operation. Read more