[−][src]Struct is_close::IsClose
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-8abs_tol
: maximum difference for being considered "close", regardless of the magnitude of the input values, defaults to 0.0method
: strategy of how to interpret relative tolerance, seeMethod
Implementations
impl<T: Float + 'static> 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 compile(&self) -> Box<dyn Fn(T, T) -> bool>
[src]
Compile current configuration into a closure which increases speed when called multiple times
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]
I: IntoIterator<Item = T>,
J: IntoIterator<Item = T>,
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]
I: IntoIterator<Item = T>,
J: IntoIterator<Item = T>,
Check whether or not two iterables a
and b
are pairwise "close" to each other in at least one place
Trait Implementations
Auto Trait Implementations
impl<T> RefUnwindSafe for IsClose<T> where
T: RefUnwindSafe,
T: RefUnwindSafe,
impl<T> Send for IsClose<T> where
T: Send,
T: Send,
impl<T> Sync for IsClose<T> where
T: Sync,
T: Sync,
impl<T> Unpin for IsClose<T> where
T: Unpin,
T: Unpin,
impl<T> UnwindSafe for IsClose<T> where
T: UnwindSafe,
T: UnwindSafe,
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, 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>,