assert_f64_lt

Macro assert_f64_lt 

Source
macro_rules! assert_f64_lt {
    ($a:expr, $b:expr $(,)?) => { ... };
    ($a:expr, $b:expr, $($message:tt)+) => { ... };
}
Expand description

Assert a floating point 64-bit number is less than another within f64::EPSILON.

Pseudocode:
a < b

  • If true, return ().

  • Otherwise, call panic! with a message and the values of the expressions with their debug representations.

§Examples

use assertables::*;

let a: f64 = 1.0 / 3.0;
let b: f64 = 0.3333333333333339;
assert_f64_lt!(a, b);

// This will panic
let a: f64 = 1.0 / 3.0;
let b: f64 = 0.3333333333333329;
assert_f64_lt!(a, b);
// assertion failed: `assert_f64_lt!(a, b)`
// https://docs.rs/assertables/…/assertables/macro.assert_f64_lt.html
//  a label: `a`,
//  a debug: `0.3333333333333333`,
//  b label: `b`,
//  b debug: `0.3333333333333329`,`
//     diff: `0.0000000000000003885780586188048`,
//        ε: `0.0000000000000002220446049250313`

§Module macros