assert_f64_far

Macro assert_f64_far 

Source
macro_rules! assert_f64_far {
    ($a:expr, $b:expr, $n:expr) => { ... };
    ($a:expr, $b:expr) => { ... };
}
Expand description

Assert two 64-bit floats are not within n steps of each other.

Panics if the two floats are less than or equal to n steps away from each other.

  • a - First float.
  • b - Second float.
  • n - Step tolerance between floats (defaults to 4).

Each step is derived from the previous float by incrementing the float’s bits, as if they were an integer, by 1. For example, the next float from 5.e-324 (0x0000000000000001) would be 1.e-323 (0x0000000000000002).

§Examples

assert_f64_far!(5e-324, 3e-323);
assert_f64_far!(5e-324, 5.4e-323, 9);
assert_f64_far!(3e300, 3.000000000000007e+300);