[][src]Struct twofloat::TwoFloat

pub struct TwoFloat { /* fields omitted */ }

Represents a two-word floating point type, represented as the sum of two non-overlapping f64 values.

Methods

impl TwoFloat[src]

pub fn try_new(a: f64, b: f64) -> Result<TwoFloat, ()>[src]

Attempts to construct a new TwoFloat from two f64 values. This can be used to reconstitute a TwoFloat from the values returned by the data method.

Errors:

An error will be returned if the supplied f64 values overlap.

Examples:

let a = 1.0f64;
let b = 1.0e-200f64;
let result = TwoFloat::try_new(a, b)?;
assert_eq!(result.data(), (a, b));

assert!(TwoFloat::try_new(1.0, 2.0).is_err());

pub fn data(&self) -> (f64, f64)[src]

Returns the high and low words of self as a tuple.

Examples:

let value = TwoFloat::new_add(1.0, 1.0e-200);
assert_eq!(value.data(), (1.0, 1.0e-200));

impl TwoFloat[src]

pub fn new_add(x: f64, y: f64) -> TwoFloat[src]

Creates a new TwoFloat by adding two f64 values using Algorithm 2 from Joldes et al. (2017).

pub fn new_sub(x: f64, y: f64) -> TwoFloat[src]

Creates a new TwoFloat by subtracting two f64 values using Algorithm 2 from Joldes et al. (2017) modified for negative right-hand side.

pub fn new_mul(x: f64, y: f64) -> TwoFloat[src]

Creates a new TwoFloat by multiplying two f64 values using Algorithm 3 from Joldes et al. (2017).

pub fn new_div(x: f64, y: f64) -> TwoFloat[src]

Creates a new TwoFloat by dividing two f64 values using Algorithm 15 from Joldes et al. (2017) modified for the left-hand-side having a zero value in the low word.

impl TwoFloat[src]

pub fn abs(&self) -> TwoFloat[src]

Returns the absolute value root of self.

Examples:

assert_eq!(TwoFloat::new_add(1.0, 1.0e-300).abs(), TwoFloat::new_add(1.0, 1.0e-300));
assert_eq!(TwoFloat::new_add(-1.0, 1.0e-300).abs(), TwoFloat::new_add(1.0, -1.0e-300));

pub fn is_sign_positive(&self) -> bool[src]

Returns true if self has a positive sign, including +0.0.

Examples:

assert!(TwoFloat::new_add(0.0, 0.0).is_sign_positive());
assert!(TwoFloat::new_add(1.0, 1.0e-300).is_sign_positive());
assert!(!TwoFloat::new_add(-1.0, 1.0e-300).is_sign_positive());

pub fn is_sign_negative(&self) -> bool[src]

Returns true if self has a negative sign, including -0.0.

Examples:

assert!(TwoFloat::new_add(-1.0, 1.0e-300).is_sign_negative());
assert!(!TwoFloat::new_add(0.0, 0.0).is_sign_negative());
assert!(!TwoFloat::new_add(1.0, 1.0e-300).is_sign_negative());

pub fn is_valid(&self) -> bool[src]

Returns true if self is a valid value, where both components are finite (not infinity or NaN).

Examples:

assert!(TwoFloat::new_add(1.0, 1.0e-300).is_valid());
assert!(!TwoFloat::new_mul(1.0e300, 1.0e300).is_valid());

Trait Implementations

impl<'a> Add<&'a TwoFloat> for f64[src]

type Output = TwoFloat

The resulting type after applying the + operator.

fn add(self, lhs: &'a TwoFloat) -> Self::Output[src]

Implements addition of TwoFloat and f64 using Joldes et al. (2017) Algorithm 4.

impl<'a> Add<&'a TwoFloat> for TwoFloat[src]

type Output = TwoFloat

The resulting type after applying the + operator.

fn add(self, rhs: &'a TwoFloat) -> Self::Output[src]

Implements addition of two TwoFloat values using Joldes et al. (2017) Algorithm 6.

impl<'a, 'b> Add<&'b TwoFloat> for &'a TwoFloat[src]

type Output = TwoFloat

The resulting type after applying the + operator.

fn add(self, rhs: &'b TwoFloat) -> Self::Output[src]

Implements addition of two TwoFloat values using Joldes et al. (2017) Algorithm 6.

impl Add<TwoFloat> for f64[src]

type Output = TwoFloat

The resulting type after applying the + operator.

fn add(self, lhs: TwoFloat) -> Self::Output[src]

Implements addition of TwoFloat and f64 using Joldes et al. (2017) Algorithm 4.

impl Add<TwoFloat> for TwoFloat[src]

type Output = TwoFloat

The resulting type after applying the + operator.

fn add(self, rhs: TwoFloat) -> Self::Output[src]

Implements addition of two TwoFloat values using Joldes et al. (2017) Algorithm 6.

impl<'a> Add<TwoFloat> for &'a TwoFloat[src]

type Output = TwoFloat

The resulting type after applying the + operator.

fn add(self, rhs: TwoFloat) -> Self::Output[src]

Implements addition of two TwoFloat values using Joldes et al. (2017) Algorithm 6.

impl Add<f64> for TwoFloat[src]

type Output = TwoFloat

The resulting type after applying the + operator.

fn add(self, rhs: f64) -> Self::Output[src]

Implements addition of TwoFloat and f64 using Joldes et al. (2017) Algorithm 4.

impl<'a> Add<f64> for &'a TwoFloat[src]

type Output = TwoFloat

The resulting type after applying the + operator.

fn add(self, rhs: f64) -> Self::Output[src]

Implements addition of TwoFloat and f64 using Joldes et al. (2017) Algorithm 4.

impl<'a> AddAssign<&'a TwoFloat> for TwoFloat[src]

fn add_assign(&mut self, rhs: &'a TwoFloat)[src]

Implements addition of two TwoFloat values using Joldes et al. (2017) Algorithm 6.

impl AddAssign<TwoFloat> for TwoFloat[src]

fn add_assign(&mut self, rhs: TwoFloat)[src]

Implements addition of two TwoFloat values using Joldes et al. (2017) Algorithm 6.

impl AddAssign<f64> for TwoFloat[src]

fn add_assign(&mut self, rhs: f64)[src]

Implements addition of TwoFloat and f64 using Joldes et al. (2017) Algorithm 4.

impl Clone for TwoFloat[src]

impl Copy for TwoFloat[src]

impl Debug for TwoFloat[src]

impl Display for TwoFloat[src]

impl<'a> Div<&'a TwoFloat> for f64[src]

type Output = TwoFloat

The resulting type after applying the / operator.

fn div(self, rhs: &'a TwoFloat) -> Self::Output[src]

Implements division of f64 and TwoFloat using Joldes et al. (2017) Algorithm 18 modified for the left-hand side having a zero value in the low word.

impl<'a> Div<&'a TwoFloat> for TwoFloat[src]

type Output = TwoFloat

The resulting type after applying the / operator.

fn div(self, rhs: &'a TwoFloat) -> Self::Output[src]

Implements division of two TwoFloat values using Joldes et al. (2017) Algorithm 18.

impl<'a, 'b> Div<&'b TwoFloat> for &'a TwoFloat[src]

type Output = TwoFloat

The resulting type after applying the / operator.

fn div(self, rhs: &'b TwoFloat) -> Self::Output[src]

Implements division of two TwoFloat values using Joldes et al. (2017) Algorithm 18.

impl Div<TwoFloat> for f64[src]

type Output = TwoFloat

The resulting type after applying the / operator.

fn div(self, rhs: TwoFloat) -> Self::Output[src]

Implements division of f64 and TwoFloat using Joldes et al. (2017) Algorithm 18 modified for the left-hand side having a zero value in the low word.

impl Div<TwoFloat> for TwoFloat[src]

type Output = TwoFloat

The resulting type after applying the / operator.

fn div(self, rhs: TwoFloat) -> Self::Output[src]

Implements division of two TwoFloat values using Joldes et al. (2017) Algorithm 18.

impl<'a> Div<TwoFloat> for &'a TwoFloat[src]

type Output = TwoFloat

The resulting type after applying the / operator.

fn div(self, rhs: TwoFloat) -> Self::Output[src]

Implements division of two TwoFloat values using Joldes et al. (2017) Algorithm 18.

impl Div<f64> for TwoFloat[src]

type Output = TwoFloat

The resulting type after applying the / operator.

fn div(self, rhs: f64) -> Self::Output[src]

Implements division of TwoFloat and f64 using Joldes et al. (2017) Algorithm 15

impl<'a> Div<f64> for &'a TwoFloat[src]

type Output = TwoFloat

The resulting type after applying the / operator.

fn div(self, rhs: f64) -> Self::Output[src]

Implements division of TwoFloat and f64 using Joldes et al. (2017) Algorithm 15

impl<'a> DivAssign<&'a TwoFloat> for TwoFloat[src]

fn div_assign(&mut self, rhs: &'a TwoFloat)[src]

Implements division of two TwoFloat values using Joldes et al. (2017) Algorithm 18.

impl DivAssign<TwoFloat> for TwoFloat[src]

fn div_assign(&mut self, rhs: TwoFloat)[src]

Implements division of two TwoFloat values using Joldes et al. (2017) Algorithm 18.

impl DivAssign<f64> for TwoFloat[src]

fn div_assign(&mut self, rhs: f64)[src]

Implements division of TwoFloat and f64 using Joldes et al. (2017) Algorithm 15

impl<'a> From<&'a TwoFloat> for f64[src]

impl<'a> From<&'a TwoFloat> for f32[src]

impl From<TwoFloat> for f64[src]

impl From<TwoFloat> for f32[src]

impl From<f32> for TwoFloat[src]

impl From<f64> for TwoFloat[src]

impl From<i16> for TwoFloat[src]

impl From<i32> for TwoFloat[src]

impl From<i64> for TwoFloat[src]

impl From<i8> for TwoFloat[src]

impl From<u16> for TwoFloat[src]

impl From<u32> for TwoFloat[src]

impl From<u64> for TwoFloat[src]

impl From<u8> for TwoFloat[src]

impl<'a> Mul<&'a TwoFloat> for f64[src]

type Output = TwoFloat

The resulting type after applying the * operator.

fn mul(self, lhs: &'a TwoFloat) -> Self::Output[src]

Implements multiplication of TwoFloat and f64 using Joldes et al. (2017) Algorithm 9.

impl<'a> Mul<&'a TwoFloat> for TwoFloat[src]

type Output = TwoFloat

The resulting type after applying the * operator.

fn mul(self, rhs: &'a TwoFloat) -> Self::Output[src]

Implements multiplication of two TwoFloat values using Joldes et al. (2017) Algorithm 12.

impl<'a, 'b> Mul<&'b TwoFloat> for &'a TwoFloat[src]

type Output = TwoFloat

The resulting type after applying the * operator.

fn mul(self, rhs: &'b TwoFloat) -> Self::Output[src]

Implements multiplication of two TwoFloat values using Joldes et al. (2017) Algorithm 12.

impl Mul<TwoFloat> for f64[src]

type Output = TwoFloat

The resulting type after applying the * operator.

fn mul(self, lhs: TwoFloat) -> Self::Output[src]

Implements multiplication of TwoFloat and f64 using Joldes et al. (2017) Algorithm 9.

impl Mul<TwoFloat> for TwoFloat[src]

type Output = TwoFloat

The resulting type after applying the * operator.

fn mul(self, rhs: TwoFloat) -> Self::Output[src]

Implements multiplication of two TwoFloat values using Joldes et al. (2017) Algorithm 12.

impl<'a> Mul<TwoFloat> for &'a TwoFloat[src]

type Output = TwoFloat

The resulting type after applying the * operator.

fn mul(self, rhs: TwoFloat) -> Self::Output[src]

Implements multiplication of two TwoFloat values using Joldes et al. (2017) Algorithm 12.

impl Mul<f64> for TwoFloat[src]

type Output = TwoFloat

The resulting type after applying the * operator.

fn mul(self, rhs: f64) -> Self::Output[src]

Implements multiplication of TwoFloat and f64 using Joldes et al. (2017) Algorithm 9.

impl<'a> Mul<f64> for &'a TwoFloat[src]

type Output = TwoFloat

The resulting type after applying the * operator.

fn mul(self, rhs: f64) -> Self::Output[src]

Implements multiplication of TwoFloat and f64 using Joldes et al. (2017) Algorithm 9.

impl<'a> MulAssign<&'a TwoFloat> for TwoFloat[src]

fn mul_assign(&mut self, rhs: &'a TwoFloat)[src]

Implements multiplication of two TwoFloat values using Joldes et al. (2017) Algorithm 12.

impl MulAssign<TwoFloat> for TwoFloat[src]

fn mul_assign(&mut self, rhs: TwoFloat)[src]

Implements multiplication of two TwoFloat values using Joldes et al. (2017) Algorithm 12.

impl MulAssign<f64> for TwoFloat[src]

fn mul_assign(&mut self, rhs: f64)[src]

Implements multiplication of TwoFloat and f64 using Joldes et al. (2017) Algorithm 9.

impl Neg for TwoFloat[src]

type Output = TwoFloat

The resulting type after applying the - operator.

fn neg(self) -> Self::Output[src]

Returns a new TwoFloat with the negated value of self.

impl<'a> Neg for &'a TwoFloat[src]

type Output = TwoFloat

The resulting type after applying the - operator.

fn neg(self) -> Self::Output[src]

Returns a new TwoFloat with the negated value of self.

impl PartialEq<TwoFloat> for TwoFloat[src]

impl PartialEq<TwoFloat> for f64[src]

impl PartialEq<f64> for TwoFloat[src]

impl PartialOrd<TwoFloat> for TwoFloat[src]

impl PartialOrd<TwoFloat> for f64[src]

impl PartialOrd<f64> for TwoFloat[src]

impl StructuralPartialEq for TwoFloat[src]

impl<'a> Sub<&'a TwoFloat> for f64[src]

type Output = TwoFloat

The resulting type after applying the - operator.

fn sub(self, rhs: &'a TwoFloat) -> Self::Output[src]

Implements subtraction of f64 and TwoFloat using Joldes et al. (2017) Algorithm 4 modified for negative left-hand side.

impl<'a> Sub<&'a TwoFloat> for TwoFloat[src]

type Output = TwoFloat

The resulting type after applying the - operator.

fn sub(self, rhs: &'a TwoFloat) -> Self::Output[src]

Implements subtraction of two TwoFloat values using Joldes et al. (2017) Algorithm 6 modified for a negative right-hand side.

impl<'a, 'b> Sub<&'b TwoFloat> for &'a TwoFloat[src]

type Output = TwoFloat

The resulting type after applying the - operator.

fn sub(self, rhs: &'b TwoFloat) -> Self::Output[src]

Implements subtraction of two TwoFloat values using Joldes et al. (2017) Algorithm 6 modified for a negative right-hand side.

impl Sub<TwoFloat> for f64[src]

type Output = TwoFloat

The resulting type after applying the - operator.

fn sub(self, rhs: TwoFloat) -> Self::Output[src]

Implements subtraction of f64 and TwoFloat using Joldes et al. (2017) Algorithm 4 modified for negative left-hand side.

impl Sub<TwoFloat> for TwoFloat[src]

type Output = TwoFloat

The resulting type after applying the - operator.

fn sub(self, rhs: TwoFloat) -> Self::Output[src]

Implements subtraction of two TwoFloat values using Joldes et al. (2017) Algorithm 6 modified for a negative right-hand side.

impl<'a> Sub<TwoFloat> for &'a TwoFloat[src]

type Output = TwoFloat

The resulting type after applying the - operator.

fn sub(self, rhs: TwoFloat) -> Self::Output[src]

Implements subtraction of two TwoFloat values using Joldes et al. (2017) Algorithm 6 modified for a negative right-hand side.

impl Sub<f64> for TwoFloat[src]

type Output = TwoFloat

The resulting type after applying the - operator.

fn sub(self, rhs: f64) -> Self::Output[src]

Implements subtraction of TwoFloat and f64 using Joldes et al. (2017) Algorithm 4 modified for negative right-hand side.

impl<'a> Sub<f64> for &'a TwoFloat[src]

type Output = TwoFloat

The resulting type after applying the - operator.

fn sub(self, rhs: f64) -> Self::Output[src]

Implements subtraction of TwoFloat and f64 using Joldes et al. (2017) Algorithm 4 modified for negative right-hand side.

impl<'a> SubAssign<&'a TwoFloat> for TwoFloat[src]

fn sub_assign(&mut self, rhs: &'a TwoFloat)[src]

Implements subtraction of two TwoFloat values using Joldes et al. (2017) Algorithm 6 modified for a negative right-hand side.

impl SubAssign<TwoFloat> for TwoFloat[src]

fn sub_assign(&mut self, rhs: TwoFloat)[src]

Implements subtraction of two TwoFloat values using Joldes et al. (2017) Algorithm 6 modified for a negative right-hand side.

impl SubAssign<f64> for TwoFloat[src]

fn sub_assign(&mut self, rhs: f64)[src]

Implements subtraction of TwoFloat and f64 using Joldes et al. (2017) Algorithm 4 modified for negative right-hand side.

impl<'a> TryFrom<&'a TwoFloat> for i32[src]

type Error = ()

The type returned in the event of a conversion error.

impl<'a> TryFrom<&'a TwoFloat> for i16[src]

type Error = ()

The type returned in the event of a conversion error.

impl<'a> TryFrom<&'a TwoFloat> for i8[src]

type Error = ()

The type returned in the event of a conversion error.

impl<'a> TryFrom<&'a TwoFloat> for u32[src]

type Error = ()

The type returned in the event of a conversion error.

impl<'a> TryFrom<&'a TwoFloat> for u16[src]

type Error = ()

The type returned in the event of a conversion error.

impl<'a> TryFrom<&'a TwoFloat> for u8[src]

type Error = ()

The type returned in the event of a conversion error.

impl<'a> TryFrom<&'a TwoFloat> for i64[src]

type Error = ()

The type returned in the event of a conversion error.

impl<'a> TryFrom<&'a TwoFloat> for u64[src]

type Error = ()

The type returned in the event of a conversion error.

impl TryFrom<TwoFloat> for i32[src]

type Error = ()

The type returned in the event of a conversion error.

impl TryFrom<TwoFloat> for i16[src]

type Error = ()

The type returned in the event of a conversion error.

impl TryFrom<TwoFloat> for i8[src]

type Error = ()

The type returned in the event of a conversion error.

impl TryFrom<TwoFloat> for u32[src]

type Error = ()

The type returned in the event of a conversion error.

impl TryFrom<TwoFloat> for u16[src]

type Error = ()

The type returned in the event of a conversion error.

impl TryFrom<TwoFloat> for u8[src]

type Error = ()

The type returned in the event of a conversion error.

impl TryFrom<TwoFloat> for i64[src]

type Error = ()

The type returned in the event of a conversion error.

impl TryFrom<TwoFloat> for u64[src]

type Error = ()

The type returned in the event of a conversion error.

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.