[−][src]Struct floating_bar::r64
The 64-bit floating bar type.
Methods
impl r64[src]
pub fn numer(self) -> u64[src]
Returns the numerator value for this rational number.
pub fn denom(self) -> u64[src]
Returns the denominator value for this rational number.
pub fn floor(self) -> r64[src]
Returns the largest integer less than or equal to a number.
pub fn ceil(self) -> r64[src]
Returns the smallest integer greater than or equal to a number.
pub fn round(self) -> r64[src]
Returns the nearest integer to a number. Round half-way cases away from zero.
pub fn trunc(self) -> r64[src]
Returns the integer part of a number.
pub fn fract(self) -> r64[src]
Returns the fractional part of a number.
pub fn abs(self) -> r64[src]
Computes the absolute value of self. Returns NaN if the number is NaN.
pub fn signum(self) -> r64[src]
Returns a number that represents the sign of self.
1if the number is positive-1if the number is negative0if the number is+0,-0, orNaN
pub fn pow(self, p: i32) -> r64[src]
Raises a number to an integer power.
pub fn checked_pow(self, p: i32) -> Option<r64>[src]
Raises a number to an integer power.
pub fn checked_sqrt(self) -> Option<r64>[src]
Takes the checked square root of a number.
If self is positive and both the numerator and denominator are perfect
squares, this returns their square root. Otherwise, returns None.
pub fn is_nan(self) -> bool[src]
Returns true if this value is NaN and false otherwise.
pub fn is_normal(self) -> bool[src]
Returns true if the number is neither zero, subnormal, or NaN.
pub fn is_positive(self) -> bool[src]
Returns true if and only if self has a positive sign, including
+0.0 (but not NaNs with positive sign bit).
pub fn is_negative(self) -> bool[src]
Returns true if and only if self has a negative sign, including
-0.0 (but not NaNs with negative sign bit).
pub fn recip(self) -> r64[src]
Takes the reciprocal (inverse) of a number, 1/x.
Panics
Panics when trying to set a numerator of zero as denominator.
pub fn max(self, other: r64) -> r64[src]
Returns the maximum of the two numbers.
If one of the arguments is NaN, then the other argument is returned.
pub fn min(self, other: r64) -> r64[src]
Returns the minimum of the two numbers.
If one of the arguments is NaN, then the other argument is returned.
pub fn to_bits(self) -> u64[src]
Raw transmutation to u64.
pub fn from_bits(bits: u64) -> r64[src]
Raw transmutation from u64.
pub fn simplify(self) -> r64[src]
Cancels out common factors between the numerator and the denominator.
Trait Implementations
impl Add<r64> for r64[src]
type Output = r64
The resulting type after applying the + operator.
fn add(self, other: r64) -> r64[src]
impl Clone for r64[src]
impl Copy for r64[src]
impl Debug for r64[src]
impl Default for r64[src]
impl Display for r64[src]
impl Div<r64> for r64[src]
type Output = r64
The resulting type after applying the / operator.
fn div(self, other: r64) -> r64[src]
impl Eq for r64[src]
impl From<f32> for r64[src]
impl From<f64> for r64[src]
fn from(f: f64) -> Self[src]
Based on: https://www.johndcook.com/blog/2010/10/20/best-rational-approximation/
impl From<i16> for r64[src]
impl From<i32> for r64[src]
impl From<i8> for r64[src]
impl From<r32> for r64[src]
impl From<u16> for r64[src]
impl From<u32> for r64[src]
impl From<u8> for r64[src]
impl FromStr for r64[src]
type Err = ParseRatioErr
The associated error which can be returned from parsing.
fn from_str(src: &str) -> Result<Self, Self::Err>[src]
Converts a string in base 10 to a rational.
This function accepts strings such as
- '157/50'
- '-157/50'
- '25', or equivalently, '25/1'
- 'NaN'
Leading and trailing whitespace represent an error.
Return value
Err(ParseRatioError) if the string did not represent a valid number.
Otherwise, Ok(n) where n is the floating-bar number represented by
src.
impl Into<f32> for r64[src]
impl Into<f64> for r64[src]
impl Mul<r64> for r64[src]
type Output = r64
The resulting type after applying the * operator.
fn mul(self, other: r64) -> r64[src]
impl Neg for r64[src]
type Output = r64
The resulting type after applying the - operator.
fn neg(self) -> Self::Output[src]
impl PartialEq<r64> for r64[src]
impl PartialOrd<r64> for r64[src]
fn partial_cmp(&self, other: &r64) -> Option<Ordering>[src]
#[must_use]fn lt(&self, other: &Rhs) -> bool1.0.0[src]
#[must_use]fn le(&self, other: &Rhs) -> bool1.0.0[src]
#[must_use]fn gt(&self, other: &Rhs) -> bool1.0.0[src]
#[must_use]fn ge(&self, other: &Rhs) -> bool1.0.0[src]
impl Rem<r64> for r64[src]
type Output = r64
The resulting type after applying the % operator.
fn rem(self, other: r64) -> r64[src]
impl StructuralEq for r64[src]
impl Sub<r64> for r64[src]
Auto Trait Implementations
impl RefUnwindSafe for r64
impl Send for r64
impl Sync for r64
impl Unpin for r64
impl UnwindSafe for r64
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,
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.
fn to_owned(&self) -> T[src]
fn clone_into(&self, target: &mut T)[src]
impl<T> ToString for T where
T: Display + ?Sized, [src]
T: Display + ?Sized,
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.
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>,