[][src]Macro float_eq::debug_assert_float_ne

macro_rules! debug_assert_float_ne {
    ($($arg:tt)*) => { ... };
}

Asserts that two floating point expressions are not equal to each other (using float_ne!).

On panic, this macro will print the values of the expressions with their debug representations, with additional information from the comparison operations (using FloatEqDebug and FloatDiff).

Like assert!, this macro has a second form, where a custom panic message can be provided.

Unlike assert_float_ne!, debug_assert_float_ne! statements are only enabled in non optimized builds by default. See debug_assert_ne! for more details.

Examples

let a: f32 = 4.;
let b: f32 = 4.1;

debug_assert_float_ne!(a, 3.9999990, rel <= f32::EPSILON);
debug_assert_float_ne!(a - b, 0., abs <= 0.00001, rel <= f32::EPSILON);
debug_assert_float_ne!(a - b, 0., abs <= 0.00001, ulps <= 10);

debug_assert_float_ne!(a - b, 0., abs <= 0.00001, ulps <= 10, "Checking that {} == {}", a, b);