assert_f32_gt

Macro assert_f32_gt 

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

Assert a floating point 32-bit number is greater than another within f32::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: f32 = 1.0 / 3.0;
let b: f32 = 0.3333331;
assert_f32_gt!(a, b);

// This will panic
let a: f32 = 1.0 / 3.0;
let b: f32 = 0.3333336;
assert_f32_gt!(a, b);
// assertion failed: `assert_f32_gt!(a, b)`
// https://docs.rs/assertables/…/assertables/macro.assert_f32_gt.html
//  a label: `a`,
//  a debug: `0.33333334`,
//  b label: `b`,
//  b debug: `0.3333336`,`
//     diff: `-0.00000029802322`,
//        ε: `0.00000011920929`

§Module macros