Enum fraction::GenericFraction
[−]
[src]
pub enum GenericFraction<T> {
Rational(Sign, Ratio<T>),
Infinity(Sign),
NaN,
}Variants
Rational(Sign, Ratio<T>)Infinity(Sign)NaNMethods
impl<T: Clone + Integer> GenericFraction<T>[src]
fn new<N, D>(num: N, den: D) -> GenericFraction<T> where N: Into<T>, D: Into<T>
fn new_neg<N, D>(num: N, den: D) -> GenericFraction<T> where N: Into<T>, D: Into<T>
fn new_raw(num: T, den: T) -> GenericFraction<T>
fn new_raw_neg(num: T, den: T) -> GenericFraction<T>
fn new_nan() -> GenericFraction<T>
fn new_inf() -> GenericFraction<T>
fn new_inf_neg() -> GenericFraction<T>
fn numer(&self) -> Option<&T>
fn denom(&self) -> Option<&T>
fn sign(&self) -> Option<&Sign>
fn into_big(self) -> BigFraction where T: Into<BigUint>
fn format_as_float(&self) -> Option<String> where T: From<u8> + Into<BigUint> + ToPrimitive + Display
impl<T: Clone + Integer> GenericFraction<T>[src]
fn nan() -> Self
fn infinity() -> Self
fn neg_infinity() -> Self
fn neg_zero() -> Self
fn min_positive_value() -> Self where T: Bounded
fn is_nan(&self) -> bool
fn is_infinite(&self) -> bool
fn is_finite(&self) -> bool
fn is_normal(&self) -> bool
fn classify(&self) -> FpCategory
fn floor(&self) -> Self
fn ceil(&self) -> Self
fn round(&self) -> Self
fn trunc(&self) -> Self
fn fract(&self) -> Self
fn abs(&self) -> Self
fn signum(&self) -> Self
fn is_sign_positive(&self) -> bool
fn is_sign_negative(&self) -> bool
fn mul_add(&self, a: Self, b: Self) -> Self
fn recip(&self) -> Self
Trait Implementations
impl<T: Clone> Clone for GenericFraction<T>[src]
fn clone(&self) -> GenericFraction<T>
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)1.0.0
Performs copy-assignment from source. Read more
impl<T: Hash> Hash for GenericFraction<T>[src]
fn hash<__HT: Hasher>(&self, __arg_0: &mut __HT)
Feeds this value into the state given, updating the hasher as necessary.
fn hash_slice<H>(data: &[Self], state: &mut H) where H: Hasher1.3.0
Feeds a slice of this type into the state provided.
impl<T: Debug> Debug for GenericFraction<T>[src]
impl<T> Copy for GenericFraction<T> where T: Copy[src]
impl<T: Bounded + Clone + Integer> Bounded for GenericFraction<T>[src]
fn min_value() -> Self
returns the smallest finite number this type can represent
fn max_value() -> Self
returns the largest finite number this type can represent
impl<T: Clone + Integer> PartialEq for GenericFraction<T>[src]
fn eq(&self, other: &Self) -> bool
This method tests for self and other values to be equal, and is used by ==. Read more
fn ne(&self, other: &Rhs) -> bool1.0.0
This method tests for !=.
impl<T: Clone + Integer> Eq for GenericFraction<T>[src]
impl<T: Clone + Integer> PartialOrd for GenericFraction<T>[src]
fn partial_cmp(&self, other: &Self) -> Option<Ordering>
This method returns an ordering between self and other values if one exists. Read more
fn lt(&self, other: &Rhs) -> bool1.0.0
This method tests less than (for self and other) and is used by the < operator. Read more
fn le(&self, other: &Rhs) -> bool1.0.0
This method tests less than or equal to (for self and other) and is used by the <= operator. Read more
fn gt(&self, other: &Rhs) -> bool1.0.0
This method tests greater than (for self and other) and is used by the > operator. Read more
fn ge(&self, other: &Rhs) -> bool1.0.0
This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more
impl<T: Clone + Integer> Neg for GenericFraction<T>[src]
type Output = GenericFraction<T>
The resulting type after applying the - operator
fn neg(self) -> Self
The method for the unary - operator
impl<T: Clone + Integer> Add for GenericFraction<T>[src]
type Output = Self
The resulting type after applying the + operator
fn add(self, other: Self) -> Self
The method for the + operator
impl<T: Clone + Integer> AddAssign for GenericFraction<T>[src]
fn add_assign(&mut self, other: Self)
The method for the += operator
impl<T: Clone + Integer> Sub for GenericFraction<T>[src]
type Output = Self
The resulting type after applying the - operator
fn sub(self, other: Self) -> Self
The method for the - operator
impl<T: Clone + Integer> SubAssign for GenericFraction<T>[src]
fn sub_assign(&mut self, other: Self)
The method for the -= operator
impl<T: Clone + Integer> Mul for GenericFraction<T>[src]
type Output = Self
The resulting type after applying the * operator
fn mul(self, other: Self) -> Self
The method for the * operator
impl<T: Clone + Integer> MulAssign for GenericFraction<T>[src]
fn mul_assign(&mut self, other: Self)
The method for the *= operator
impl<T: Clone + Integer> Div for GenericFraction<T>[src]
type Output = Self
The resulting type after applying the / operator
fn div(self, other: Self) -> Self
The method for the / operator
impl<T: Clone + Integer> DivAssign for GenericFraction<T>[src]
fn div_assign(&mut self, other: Self)
The method for the /= operator
impl<T: Clone + Integer> Rem for GenericFraction<T>[src]
type Output = Self
The resulting type after applying the % operator
fn rem(self, other: Self) -> Self
The method for the % operator
impl<T: Clone + Integer> RemAssign for GenericFraction<T>[src]
fn rem_assign(&mut self, other: Self)
The method for the %= operator
impl<T: Clone + Integer> Zero for GenericFraction<T>[src]
fn zero() -> Self
Returns the additive identity element of Self, 0. Read more
fn is_zero(&self) -> bool
Returns true if self is equal to the additive identity.
impl<T: Clone + Integer> One for GenericFraction<T>[src]
impl<T: Clone + Integer> Num for GenericFraction<T>[src]
type FromStrRadixErr = ParseRatioError
fn from_str_radix(str: &str, radix: u32) -> Result<Self, Self::FromStrRadixErr>
Convert from a string and radix <= 36.
impl<T: Clone + Integer> Signed for GenericFraction<T>[src]
fn abs(&self) -> Self
Computes the absolute value. Read more
fn abs_sub(&self, other: &Self) -> Self
The positive difference of two numbers. Read more
fn signum(&self) -> Self
Returns the sign of the number. Read more
fn is_positive(&self) -> bool
Returns true if the number is positive and false if the number is zero or negative.
fn is_negative(&self) -> bool
Returns true if the number is negative and false if the number is zero or positive.
impl<T: Clone + Integer + PartialEq + ToPrimitive> ToPrimitive for GenericFraction<T>[src]
fn to_i64(&self) -> Option<i64>
Converts the value of self to an i64.
fn to_u64(&self) -> Option<u64>
Converts the value of self to an u64.
fn to_f64(&self) -> Option<f64>
Converts the value of self to an f64.
fn to_isize(&self) -> Option<isize>
Converts the value of self to an isize.
fn to_i8(&self) -> Option<i8>
Converts the value of self to an i8.
fn to_i16(&self) -> Option<i16>
Converts the value of self to an i16.
fn to_i32(&self) -> Option<i32>
Converts the value of self to an i32.
fn to_usize(&self) -> Option<usize>
Converts the value of self to a usize.
fn to_u8(&self) -> Option<u8>
Converts the value of self to an u8.
fn to_u16(&self) -> Option<u16>
Converts the value of self to an u16.
fn to_u32(&self) -> Option<u32>
Converts the value of self to an u32.
fn to_f32(&self) -> Option<f32>
Converts the value of self to an f32.
impl<T: Display + Eq + One> Display for GenericFraction<T>[src]
impl<T: Clone + Integer> From<u8> for GenericFraction<T> where u8: Into<T>[src]
fn from(val: u8) -> GenericFraction<T>
Performs the conversion.
impl<T: Clone + Integer> From<u16> for GenericFraction<T> where u16: Into<T>[src]
fn from(val: u16) -> GenericFraction<T>
Performs the conversion.
impl<T: Clone + Integer> From<u32> for GenericFraction<T> where u32: Into<T>[src]
fn from(val: u32) -> GenericFraction<T>
Performs the conversion.
impl<T: Clone + Integer> From<u64> for GenericFraction<T> where u64: Into<T>[src]
fn from(val: u64) -> GenericFraction<T>
Performs the conversion.
impl<T: Clone + Integer> From<BigUint> for GenericFraction<T> where BigUint: Into<T>[src]
fn from(val: BigUint) -> GenericFraction<T>
Performs the conversion.
impl<T: Clone + Integer> From<i8> for GenericFraction<T>[src]
fn from(val: i8) -> GenericFraction<T>
Performs the conversion.
impl<T: Clone + Integer> From<i16> for GenericFraction<T>[src]
fn from(val: i16) -> GenericFraction<T>
Performs the conversion.
impl<T: Clone + Integer> From<i32> for GenericFraction<T>[src]
fn from(val: i32) -> GenericFraction<T>
Performs the conversion.
impl<T: Clone + Integer> From<i64> for GenericFraction<T>[src]
fn from(val: i64) -> GenericFraction<T>
Performs the conversion.
impl<T: Clone + Integer> From<isize> for GenericFraction<T>[src]
fn from(val: isize) -> GenericFraction<T>
Performs the conversion.
impl<T: Clone + Integer> From<usize> for GenericFraction<T>[src]
fn from(val: usize) -> GenericFraction<T>
Performs the conversion.
impl<T: Clone + Integer + CheckedAdd + CheckedMul> From<f32> for GenericFraction<T>[src]
fn from(val: f32) -> GenericFraction<T>
Performs the conversion.
impl<T: Clone + Integer + CheckedAdd + CheckedMul> From<f64> for GenericFraction<T>[src]
fn from(val: f64) -> GenericFraction<T>
Performs the conversion.
impl<T> From<BigInt> for GenericFraction<T> where T: Clone + Integer + From<BigUint>[src]
fn from(int: BigInt) -> Self
Performs the conversion.
impl<T, N, D> From<(N, D)> for GenericFraction<T> where T: Clone + Integer, N: Display, D: Display[src]
fn from(pair: (N, D)) -> GenericFraction<T>
Performs the conversion.