Struct cycle::Rational [−][src]
Implementations
impl Rational
[src]
pub const fn new(num: Integer, den: Integer) -> Rational
[src]
pub fn zero() -> Rational
[src]
pub fn one() -> Rational
[src]
pub fn trunc(&self) -> Rational
[src]
pub fn fract(&self) -> Rational
[src]
pub fn is_positive(&self) -> bool
[src]
pub fn is_negative(&self) -> bool
[src]
Trait Implementations
impl Add<Rational> for Rational
[src]
type Output = Rational
The resulting type after applying the +
operator.
fn add(self, o: Self) -> Self::Output
[src]
a/b + c/d = (a*lcm/b + c*lcm/d)/lcm where lcm = lcm(b,d)
impl Clone for Rational
[src]
impl Copy for Rational
[src]
impl Debug for Rational
[src]
impl Div<Rational> for Rational
[src]
type Output = Rational
The resulting type after applying the /
operator.
fn div(self, o: Self) -> Self::Output
[src]
a/b / c/d = (a/gcd_ac)*(d/gcd_bd) / ((c/gcd_ac)*(b/gcd_bd))
impl Domain for Rational
[src]
fn name(&self) -> String
[src]
fn num(&self) -> i128
[src]
fn den(&self) -> i128
[src]
fn gcd(u: &Self, v: &Self) -> Self
[src]
gcd(a/b, c/d) = gcd(a*d, c*b)/(b*d)
fn lcm(u: &Self, v: &Self) -> Self
[src]
lcm(a/b, c/d) = lcm(a, c)/gcd(b, d)
fn cofactors(&self, u: &Self, v: &Self) -> (Self, Self, Self)
[src]
impl Eq for Rational
[src]
impl Field for Rational
[src]
impl From<i128> for Rational
[src]
impl Hash for Rational
[src]
fn hash<__H: Hasher>(&self, state: &mut __H)
[src]
pub fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
impl Mul<Rational> for Rational
[src]
type Output = Rational
The resulting type after applying the *
operator.
fn mul(self, o: Self) -> Self::Output
[src]
a/b * c/d = (a/gcd_ad)*(c/gcd_bc) / ((d/gcd_ad)*(b/gcd_bc))
impl Neg for Rational
[src]
type Output = Rational
The resulting type after applying the -
operator.
fn neg(self) -> Rational
[src]
impl Ord for Rational
[src]
fn cmp(&self, other: &Rational) -> Ordering
[src]
#[must_use]pub fn max(self, other: Self) -> Self
1.21.0[src]
#[must_use]pub fn min(self, other: Self) -> Self
1.21.0[src]
#[must_use]pub fn clamp(self, min: Self, max: Self) -> Self
1.50.0[src]
impl PartialEq<Rational> for Rational
[src]
fn eq(&self, other: &Rational) -> bool
[src]
#[must_use]pub fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
impl PartialOrd<Rational> for Rational
[src]
fn partial_cmp(&self, other: &Rational) -> Option<Ordering>
[src]
#[must_use]pub fn lt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]pub fn le(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]pub fn gt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]pub fn ge(&self, other: &Rhs) -> bool
1.0.0[src]
impl Ring for Rational
[src]
impl Sub<Rational> for Rational
[src]
Auto Trait Implementations
impl RefUnwindSafe for Rational
impl Send for Rational
impl Sync for Rational
impl Unpin for Rational
impl UnwindSafe for Rational
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,