pub fn approx_eq<T: Debug + Float + FloatConst + Copy>(
expected: T,
) -> NearMatcher<T>
Expand description
Matches a value approximately equal to expected
.
This automatically computes a tolerance from the magnitude of expected
and
matches any actual value within this tolerance of the expected value. The
tolerance is chosen to account for the inaccuracies in most ordinary
floating point calculations.
Otherwise this works analogously to near
; see its documentation for
further notes.