Skip to main content

DoubleF64

Struct DoubleF64 

Source
pub struct DoubleF64 {
    pub hi: f64,
    pub lo: f64,
}
Expand description

A double-precision floating-point number: hi + lo with |lo| ≤ 0.5·ulp(hi).

Provides ~31 decimal digits (~84 binary bits) of precision.

Fields§

§hi: f64

High-order component (the “main” value).

§lo: f64

Low-order component (the error term).

Implementations§

Source§

impl DoubleF64

Source

pub const ZERO: DoubleF64

The zero value.

Source

pub const ONE: DoubleF64

The unit value.

Source

pub fn new(hi: f64, lo: f64) -> DoubleF64

Create a new DoubleF64 from high and low components. The caller must ensure |lo| ≤ 0.5·ulp(hi) for correct results.

Source

pub fn from_f64(x: f64) -> DoubleF64

Create from a single f64.

Source

pub fn to_f64(self) -> f64

Extract the high-order component as f64.

Source

pub fn quick_two_sum(a: f64, b: f64) -> DoubleF64

Create from two f64 values, normalizing via TwoSum.

Source

pub fn two_sum(a: f64, b: f64) -> DoubleF64

Dekker’s TwoSum: error-free sum with rounding error captured.

Source

pub fn abs(self) -> DoubleF64

Absolute value.

Source

pub fn is_nan(self) -> bool

Check if the value is NaN.

Source

pub fn is_infinite(self) -> bool

Check if the value is infinite.

Source

pub fn is_finite(self) -> bool

Check if the value is finite.

Source

pub fn add(self, other: DoubleF64) -> DoubleF64

Add two DoubleF64 values.

Source

pub fn sub(self, other: DoubleF64) -> DoubleF64

Subtract two DoubleF64 values.

Source

pub fn mul(self, other: DoubleF64) -> DoubleF64

Multiply two DoubleF64 values.

Source

pub fn div(self, other: DoubleF64) -> DoubleF64

Divide two DoubleF64 values.

Source

pub fn powi(self, n: i64) -> DoubleF64

Integer power via binary exponentiation.

Source

pub fn sqrt(self) -> DoubleF64

Square root via Newton iteration.

Source

pub fn dabs(self) -> DoubleF64

Absolute value.

Source

pub fn exp(self) -> DoubleF64

Exponential function via Taylor series with argument reduction.

Source

pub fn ln(self) -> DoubleF64

Natural logarithm via Newton iteration on exp.

Source

pub fn sin(self) -> DoubleF64

Sine via Taylor series with argument reduction.

Source

pub fn cos(self) -> DoubleF64

Cosine via sin(π/2 - x).

Source

pub fn tan(self) -> DoubleF64

Tangent = sin / cos.

Trait Implementations§

Source§

impl Add for DoubleF64

Source§

type Output = DoubleF64

The resulting type after applying the + operator.
Source§

fn add(self, other: DoubleF64) -> DoubleF64

Performs the + operation. Read more
Source§

impl AddAssign for DoubleF64

Source§

fn add_assign(&mut self, other: DoubleF64)

Performs the += operation. Read more
Source§

impl Clone for DoubleF64

Source§

fn clone(&self) -> DoubleF64

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for DoubleF64

Source§

impl Debug for DoubleF64

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl Display for DoubleF64

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl Div for DoubleF64

Source§

type Output = DoubleF64

The resulting type after applying the / operator.
Source§

fn div(self, other: DoubleF64) -> DoubleF64

Performs the / operation. Read more
Source§

impl DivAssign for DoubleF64

Source§

fn div_assign(&mut self, other: DoubleF64)

Performs the /= operation. Read more
Source§

impl Eq for DoubleF64

Source§

impl EvaluationDomain for DoubleF64

Source§

fn from_f64(value: f64) -> DoubleF64

Create a value from an f64.
Source§

fn zero() -> DoubleF64

The additive identity (0).
Source§

fn one() -> DoubleF64

The multiplicative identity (1).
Source§

fn add_ref(&self, other: &DoubleF64) -> DoubleF64

self + other
Source§

fn sub_ref(&self, other: &DoubleF64) -> DoubleF64

self - other
Source§

fn mul_ref(&self, other: &DoubleF64) -> DoubleF64

self * other
Source§

fn div_ref(&self, other: &DoubleF64) -> Result<DoubleF64, EvaluationError>

self / other, or EvaluationError::DivisionByZero if other is zero.
Source§

fn neg_ref(&self) -> DoubleF64

-self
Source§

fn powi_ref(&self, exp: i64) -> DoubleF64

self^exp for integer exponents. Returns 1 when exp == 0.
Source§

fn resolve_builtin( name: &str, arg: &DoubleF64, ) -> Result<DoubleF64, EvaluationError>

Resolve a built-in mathematical function. Read more
Source§

impl From<f64> for DoubleF64

Source§

fn from(x: f64) -> DoubleF64

Converts to this type from the input type.
Source§

impl Mul for DoubleF64

Source§

type Output = DoubleF64

The resulting type after applying the * operator.
Source§

fn mul(self, other: DoubleF64) -> DoubleF64

Performs the * operation. Read more
Source§

impl MulAssign for DoubleF64

Source§

fn mul_assign(&mut self, other: DoubleF64)

Performs the *= operation. Read more
Source§

impl Neg for DoubleF64

Source§

type Output = DoubleF64

The resulting type after applying the - operator.
Source§

fn neg(self) -> DoubleF64

Performs the unary - operation. Read more
Source§

impl PartialEq for DoubleF64

Source§

fn eq(&self, other: &DoubleF64) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl PartialOrd for DoubleF64

Source§

fn partial_cmp(&self, other: &DoubleF64) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 (const: unstable) · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 (const: unstable) · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 (const: unstable) · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 (const: unstable) · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl PowfExtension for DoubleF64

Source§

fn powf_ref(&self, exp: &DoubleF64) -> Result<DoubleF64, EvaluationError>

self^exp for floating-point exponents.
Source§

impl StructuralPartialEq for DoubleF64

Source§

impl Sub for DoubleF64

Source§

type Output = DoubleF64

The resulting type after applying the - operator.
Source§

fn sub(self, other: DoubleF64) -> DoubleF64

Performs the - operation. Read more
Source§

impl SubAssign for DoubleF64

Source§

fn sub_assign(&mut self, other: DoubleF64)

Performs the -= operation. Read more
Source§

impl Zero for DoubleF64

Source§

fn zero() -> DoubleF64

Returns the additive identity element of Self, 0. Read more
Source§

fn is_zero(&self) -> bool

Returns true if self is equal to the additive identity.
Source§

fn set_zero(&mut self)

Sets self to the additive identity element of Self, 0.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T, Right> ClosedAdd<Right> for T
where T: Add<Right, Output = T> + AddAssign<Right>,

Source§

impl<T, Right> ClosedDiv<Right> for T
where T: Div<Right, Output = T> + DivAssign<Right>,

Source§

impl<T, Right> ClosedMul<Right> for T
where T: Mul<Right, Output = T> + MulAssign<Right>,

Source§

impl<T> ClosedNeg for T
where T: Neg<Output = T>,

Source§

impl<T, Right> ClosedSub<Right> for T
where T: Sub<Right, Output = T> + SubAssign<Right>,

Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
Source§

impl<N, A, B> MulAcc<A, B> for N
where &'x A: for<'x> Mul<&'x B, Output = N>, N: AddAssign,

Source§

fn mul_acc(&mut self, a: &A, b: &B)

Multiply and accumulate in this variable, formally *self += a * b.
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<SS, SP> SupersetOf<SS> for SP
where SS: SubsetOf<SP>,

Source§

fn to_subset(&self) -> Option<SS>

The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more
Source§

fn is_in_subset(&self) -> bool

Checks if self is actually part of its subset T (and can be converted to it).
Source§

unsafe fn to_subset_unchecked(&self) -> SS

Use with care! Same as self.to_subset but without any property checks. Always succeeds.
Source§

fn from_subset(element: &SS) -> SP

The inclusion map: converts self to the equivalent element of its superset.
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V