[][src]Struct float_cmp::F64Margin

pub struct F64Margin {
    pub epsilon: f64,
    pub ulps: i64,
}

This type defines a margin within two f32s might be considered equal and is intended as the associated type for the ApproxEq trait.

Two methods are used to determine approximate equality.

First an epsilon method is used, considering them approximately equal if they differ by <= epsilon. This will only succeed for very small numbers. Note that it may succeed even if the parameters are of differing signs straddling zero.

The second method considers how many ULPs (units of least precision, units in the last place, which is the integer number of floating point representations that the parameters are separated by) different the parameters are and considers them approximately equal if this <= ulps. For large floating point numbers, an ULP can be a rather large gap, but this kind of comparison is necessary because floating point operations must round to the nearest representable value and so larger floating point values accumulate larger errors.

Fields

epsilon: f64ulps: i64

Methods

impl F64Margin[src]

pub fn zero() -> F64Margin[src]

pub fn epsilon(self, epsilon: f64) -> Self[src]

pub fn ulps(self, ulps: i64) -> Self[src]

Trait Implementations

impl Copy for F64Margin[src]

impl Clone for F64Margin[src]

fn clone_from(&mut self, source: &Self)1.0.0[src]

Performs copy-assignment from source. Read more

impl From<(f64, i64)> for F64Margin[src]

impl Default for F64Margin[src]

impl Debug for F64Margin[src]

Auto Trait Implementations

impl Send for F64Margin

impl Sync for F64Margin

Blanket Implementations

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

type Owned = T

The resulting type after obtaining ownership.

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

impl<T> From<T> for T[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.

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

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

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