pub trait RoughlyEqual<T> {
    fn roughly_equal(&self, other: T) -> bool;
}
Expand description

Determines whether or not two values of an imprecise type are close enough to call equal.

Provides implementations for f32 and f64 using std::f32::EPSILON and std::f64::EPSILON as the max allowable difference.

Examples

assert!(0.0_f32.roughly_equal(0.0000001));
assert!(!0.0_f32.roughly_equal(0.000001));
assert!(0.0_f64.roughly_equal(0.00000000000000001));

Required Methods

Evalues whether the current value is roughly equal to other within the types maximum allowable difference.

Implementations on Foreign Types

Implementors