pub trait AssertIsCloseToWithDefaultMargin<E> {
// Required methods
fn is_close_to(self, expected: E) -> Self;
fn is_not_close_to(self, expected: E) -> Self;
}float-cmp only.Expand description
Assert approximate equality for floating point numbers.
Required Methods§
Sourcefn is_close_to(self, expected: E) -> Self
fn is_close_to(self, expected: E) -> Self
Verifies that the actual value is approximately equal to the expected value.
For the approximation, a default margin with 4 * epsilon and 4 * ULPS is used.
The following articles describe the challenges with comparing floating point numbers and the meaning of the epsilon and ULPS values:
Sourcefn is_not_close_to(self, expected: E) -> Self
fn is_not_close_to(self, expected: E) -> Self
Verifies that the actual value is not approximately equal to the expected value.
For the approximation, a default margin with 4 * epsilon and 4 * ULPS is used.
The following articles describe the challenges with comparing floating point numbers and the meaning of the epsilon and ULPS values:
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.