[][src]Struct is_close::IsClose

pub struct IsClose<T: Float> { /* fields omitted */ }

Compare two floats with some tolerance

This type holds information on how to compare floats and is heavily inspired by Python's PEP 485. It holds the following parameters:

  • rel_tol: maximum difference for being considered "close", relative to the magnitude of the input values, defaults to 1e-8
  • abs_tol: maximum difference for being considered "close", regardless of the magnitude of the input values, defaults to 0.0
  • method: strategy of how to interpret relative tolerance, see Method

Implementations

impl<T: Float> IsClose<T>[src]

pub fn rel_tol(&mut self, value: T) -> &mut Self[src]

Set the relative tolerance

pub fn abs_tol(&mut self, value: T) -> &mut Self[src]

Set the absolute tolerance

pub fn method<M: Into<Method>>(&mut self, method: M) -> &mut Self[src]

Set the strategy used to handle relative tolerance

pub fn is_close(&self, a: T, b: T) -> bool[src]

Check whether or not two values a and b are "close" to each other

pub fn all_close<I, J>(&self, a: I, b: J) -> bool where
    I: IntoIterator<Item = T>,
    J: IntoIterator<Item = T>, 
[src]

Check whether or not two iterables a and b are pairwise "close" to each other

pub fn any_close<I, J>(&self, a: I, b: J) -> bool where
    I: IntoIterator<Item = T>,
    J: IntoIterator<Item = T>, 
[src]

Check whether or not two iterables a and b are pairwise "close" to each other in at least one place

Trait Implementations

impl<T: Float + Debug> Debug for IsClose<T>[src]

impl<T: Float> Default for IsClose<T>[src]

Auto Trait Implementations

impl<T> RefUnwindSafe for IsClose<T> where
    T: RefUnwindSafe

impl<T> Send for IsClose<T> where
    T: Send

impl<T> Sync for IsClose<T> where
    T: Sync

impl<T> Unpin for IsClose<T> where
    T: Unpin

impl<T> UnwindSafe for IsClose<T> where
    T: UnwindSafe

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, 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.