pub struct Rational { /* private fields */ }Expand description
Rational number in canonical form.
Implementations§
Source§impl Rational
impl Rational
Sourcepub fn new(p: i32, q: i32) -> Self
pub fn new(p: i32, q: i32) -> Self
Finds the irreducible fraction of numerator p and denominator q.
§Panics
Panics if denominator is zero.
Sourcepub const fn is_negative(&self) -> bool
pub const fn is_negative(&self) -> bool
Whether this rational number is negative.
Sourcepub const fn is_positive(&self) -> bool
pub const fn is_positive(&self) -> bool
Whether this rational number is positive.
Trait Implementations§
Source§impl AddAssign<i32> for Rational
impl AddAssign<i32> for Rational
Source§fn add_assign(&mut self, other: i32)
fn add_assign(&mut self, other: i32)
Performs the
+= operation. Read moreSource§impl AddAssign for Rational
impl AddAssign for Rational
Source§fn add_assign(&mut self, other: Self)
fn add_assign(&mut self, other: Self)
Performs the
+= operation. Read moreSource§impl Div<Rational> for Polynomial
impl Div<Rational> for Polynomial
Source§impl DivAssign<Rational> for Polynomial
impl DivAssign<Rational> for Polynomial
Source§fn div_assign(&mut self, other: Rational)
fn div_assign(&mut self, other: Rational)
Performs the
/= operation. Read moreSource§impl DivAssign<i32> for Rational
impl DivAssign<i32> for Rational
Source§fn div_assign(&mut self, other: i32)
fn div_assign(&mut self, other: i32)
Performs the
/= operation. Read moreSource§impl DivAssign for Rational
impl DivAssign for Rational
Source§fn div_assign(&mut self, other: Self)
fn div_assign(&mut self, other: Self)
Performs the
/= operation. Read moreSource§impl Factor for Rational
impl Factor for Rational
Source§fn gcd_bulk(r: impl IntoIterator<Item = Self>) -> Self
fn gcd_bulk(r: impl IntoIterator<Item = Self>) -> Self
Finds the GCD of iterator over
Self.Source§fn lcm_bulk(r: impl IntoIterator<Item = Self>) -> Self
fn lcm_bulk(r: impl IntoIterator<Item = Self>) -> Self
Finds the LCM of iterator over
Self.Source§fn signed(
f: impl Fn(Self, Self) -> Self,
r: impl IntoIterator<Item = Self>,
) -> Self
fn signed( f: impl Fn(Self, Self) -> Self, r: impl IntoIterator<Item = Self>, ) -> Self
Source§impl Mul<Rational> for Polynomial
impl Mul<Rational> for Polynomial
Source§impl MulAssign<Rational> for Polynomial
impl MulAssign<Rational> for Polynomial
Source§fn mul_assign(&mut self, other: Rational)
fn mul_assign(&mut self, other: Rational)
Performs the
*= operation. Read moreSource§impl MulAssign<i32> for Rational
impl MulAssign<i32> for Rational
Source§fn mul_assign(&mut self, other: i32)
fn mul_assign(&mut self, other: i32)
Performs the
*= operation. Read moreSource§impl MulAssign for Rational
impl MulAssign for Rational
Source§fn mul_assign(&mut self, other: Self)
fn mul_assign(&mut self, other: Self)
Performs the
*= operation. Read moreSource§impl Ord for Rational
impl Ord for Rational
Source§impl PartialOrd for Rational
impl PartialOrd for Rational
Source§impl SubAssign<i32> for Rational
impl SubAssign<i32> for Rational
Source§fn sub_assign(&mut self, other: i32)
fn sub_assign(&mut self, other: i32)
Performs the
-= operation. Read moreSource§impl SubAssign for Rational
impl SubAssign for Rational
Source§fn sub_assign(&mut self, other: Self)
fn sub_assign(&mut self, other: Self)
Performs the
-= operation. Read moreimpl Copy for Rational
impl Eq for Rational
impl StructuralPartialEq for Rational
Auto Trait Implementations§
impl Freeze for Rational
impl RefUnwindSafe for Rational
impl Send for Rational
impl Sync for Rational
impl Unpin for Rational
impl UnwindSafe for Rational
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