pub struct ApproxRational {
num: BigInt,
denom: Denom,
}Expand description
A BigRational that approximates to some precision in
Rational::div_up_as_keep_factor(). The other operations behave exactly
as BigRational.
Fields§
§num: BigInt§denom: DenomImplementations§
Source§impl ApproxRational
impl ApproxRational
fn reduced(&self) -> BigRational
Trait Implementations§
Source§impl Add<&ApproxRational> for &ApproxRational
impl Add<&ApproxRational> for &ApproxRational
Source§type Output = ApproxRational
type Output = ApproxRational
The resulting type after applying the
+ operator.Source§fn add(self, rhs: &ApproxRational) -> ApproxRational
fn add(self, rhs: &ApproxRational) -> ApproxRational
Performs the
+ operation. Read moreSource§impl Add<&ApproxRational> for ApproxRational
impl Add<&ApproxRational> for ApproxRational
Source§impl Add for ApproxRational
impl Add for ApproxRational
Source§impl AddAssign<&ApproxRational> for ApproxRational
impl AddAssign<&ApproxRational> for ApproxRational
Source§fn add_assign(&mut self, rhs: &Self)
fn add_assign(&mut self, rhs: &Self)
Performs the
+= operation. Read moreSource§impl AddAssign for ApproxRational
impl AddAssign for ApproxRational
Source§fn add_assign(&mut self, rhs: Self)
fn add_assign(&mut self, rhs: Self)
Performs the
+= operation. Read moreSource§impl Clone for ApproxRational
impl Clone for ApproxRational
Source§fn clone(&self) -> ApproxRational
fn clone(&self) -> ApproxRational
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ApproxRational
impl Debug for ApproxRational
Source§impl Display for ApproxRational
impl Display for ApproxRational
Source§impl Div<&BigInt> for &ApproxRational
impl Div<&BigInt> for &ApproxRational
Source§type Output = ApproxRational
type Output = ApproxRational
The resulting type after applying the
/ operator.Source§impl Div<BigInt> for ApproxRational
impl Div<BigInt> for ApproxRational
Source§impl DivAssign<&BigInt> for ApproxRational
impl DivAssign<&BigInt> for ApproxRational
Source§fn div_assign(&mut self, rhs: &BigInt)
fn div_assign(&mut self, rhs: &BigInt)
Performs the
/= operation. Read moreSource§impl Mul<&ApproxRational> for &ApproxRational
impl Mul<&ApproxRational> for &ApproxRational
Source§type Output = ApproxRational
type Output = ApproxRational
The resulting type after applying the
* operator.Source§fn mul(self, rhs: &ApproxRational) -> ApproxRational
fn mul(self, rhs: &ApproxRational) -> ApproxRational
Performs the
* operation. Read moreSource§impl Mul<&ApproxRational> for ApproxRational
impl Mul<&ApproxRational> for ApproxRational
Source§impl Mul<&BigInt> for &ApproxRational
impl Mul<&BigInt> for &ApproxRational
Source§type Output = ApproxRational
type Output = ApproxRational
The resulting type after applying the
* operator.Source§impl Mul<BigInt> for ApproxRational
impl Mul<BigInt> for ApproxRational
Source§impl Mul for ApproxRational
impl Mul for ApproxRational
Source§impl MulAssign<&ApproxRational> for ApproxRational
impl MulAssign<&ApproxRational> for ApproxRational
Source§fn mul_assign(&mut self, rhs: &Self)
fn mul_assign(&mut self, rhs: &Self)
Performs the
*= operation. Read moreSource§impl MulAssign for ApproxRational
impl MulAssign for ApproxRational
Source§fn mul_assign(&mut self, rhs: Self)
fn mul_assign(&mut self, rhs: Self)
Performs the
*= operation. Read moreSource§impl One for ApproxRational
impl One for ApproxRational
Source§impl Ord for ApproxRational
impl Ord for ApproxRational
Source§impl PartialEq for ApproxRational
impl PartialEq for ApproxRational
Source§impl PartialOrd for ApproxRational
impl PartialOrd for ApproxRational
Source§impl Product for ApproxRational
impl Product for ApproxRational
Source§impl Rational<BigInt> for ApproxRational
impl Rational<BigInt> for ApproxRational
Source§fn ratio_i(num: BigInt, denom: BigInt) -> Self
fn ratio_i(num: BigInt, denom: BigInt) -> Self
Obtains a number equal to the ratio between the given numerator and
denominator.
Source§fn to_f64(&self) -> f64
fn to_f64(&self) -> f64
Converts a number into its floating-point approximation. This can be
useful to print approximation of large numbers.
Source§fn is_exact() -> bool
fn is_exact() -> bool
Whether this type represents exact arithmetic, i.e.
Self::epsilon()
is zero.Source§fn description() -> &'static str
fn description() -> &'static str
Description of the implemented arithmetic, e.g. “64-bit floating point
arithmetic”.
Source§fn div_up_as_keep_factor(&self, rhs: &Self) -> Self
fn div_up_as_keep_factor(&self, rhs: &Self) -> Self
Performs a division to obtain a keep factor. The division is rounded up
for types that cannot compute the result precisely. Additionally,
types may further round the result, which can be useful with exact
arithmetic, to avoid complexity explosion of rational numbers.
Source§fn from_usize(i: usize) -> Self
fn from_usize(i: usize) -> Self
Obtains a number equal to the given integer.
Source§fn ratio(num: usize, denom: usize) -> Self
fn ratio(num: usize, denom: usize) -> Self
Obtains a number equal to the ratio between the given numerator and
denominator.
Source§impl Sub<&ApproxRational> for &ApproxRational
impl Sub<&ApproxRational> for &ApproxRational
Source§type Output = ApproxRational
type Output = ApproxRational
The resulting type after applying the
- operator.Source§fn sub(self, rhs: &ApproxRational) -> ApproxRational
fn sub(self, rhs: &ApproxRational) -> ApproxRational
Performs the
- operation. Read moreSource§impl Sub<&ApproxRational> for ApproxRational
impl Sub<&ApproxRational> for ApproxRational
Source§impl Sub for ApproxRational
impl Sub for ApproxRational
Source§impl SubAssign<&ApproxRational> for ApproxRational
impl SubAssign<&ApproxRational> for ApproxRational
Source§fn sub_assign(&mut self, rhs: &Self)
fn sub_assign(&mut self, rhs: &Self)
Performs the
-= operation. Read moreSource§impl SubAssign for ApproxRational
impl SubAssign for ApproxRational
Source§fn sub_assign(&mut self, rhs: Self)
fn sub_assign(&mut self, rhs: Self)
Performs the
-= operation. Read moreSource§impl<'a> Sum<&'a ApproxRational> for ApproxRational
impl<'a> Sum<&'a ApproxRational> for ApproxRational
Source§impl Sum for ApproxRational
impl Sum for ApproxRational
Source§impl Zero for ApproxRational
impl Zero for ApproxRational
impl Eq for ApproxRational
impl RationalRef<&BigInt, ApproxRational> for &ApproxRational
Auto Trait Implementations§
impl Freeze for ApproxRational
impl RefUnwindSafe for ApproxRational
impl Send for ApproxRational
impl Sync for ApproxRational
impl Unpin for ApproxRational
impl UnwindSafe for ApproxRational
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more