[][src]Macro chek::not_almost_zero_with_tolerance

macro_rules! not_almost_zero_with_tolerance {
    ($value:expr, $tolerance:expr $(,)?) => { ... };
    ($value:expr, $tolerance:expr, $($msg_args:tt)+) => { ... };
}

Panics if the provided value is not almost equal to zero.

Uses the almost crate. See the almost::zero_with_tolerance documentation for more details.

A debug-only version is available as chek::debug_not_almost_zero_with_tolerance!.

Optionally may take an additional message to display on failure, which is formatted using standard format syntax.

Example

chek::not_almost_zero_with_tolerance!(0.1, 0.01);
chek::not_almost_zero_with_tolerance!(std::f32::EPSILON, std::f32::EPSILON / 2.0, "Should not be almost zero!");