Testing module

near

procedureextensionsince 0.30.0Source

|value - want| <= tolerance. NaN is never near anything.

Example↗
assert_that(0.1 + 0.2, near(0.3, 0.0001));
near :: (want: float64, tolerance: float64) -> Matcher

|value - want| <= tolerance. NaN is never near anything.

Parameters

want: float64
the value to be close to.
tolerance: float64
the largest allowed difference.

Returns

Example↗
assert_that(0.1 + 0.2, near(0.3, 0.0001));

See also