Skip to content

Commit

Permalink
macros...
Browse files Browse the repository at this point in the history
  • Loading branch information
LorrensP-2158466 committed Feb 8, 2025
1 parent 064357f commit 9a397ea
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions tests/pass/float.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,6 @@ use std::fmt::{Debug, Display, LowerHex};
use std::hint::black_box;
use std::{f32, f64};

// accept up to 64ULP (16ULP for host floats and 16ULP for artificial error and 32 for any rounding errors)
const ALLOWED_ULP_DIFF: i128 = 64;

/// Another form of checking if 2 floating point numbers are almost equal to eachother
/// Using `a` and `b` as floating point numbers:
///
Expand Down Expand Up @@ -74,7 +71,8 @@ macro_rules! assert_approx_eq {
}};

($a:expr, $b: expr) => {
assert_approx_eq!($a, $b, ALLOWED_ULP_DIFF);
// accept up to 64ULP (16ULP for host floats and 16ULP for artificial error and 32 for any rounding errors)
assert_approx_eq!($a, $b, 64); // in macro because of type-checking
};
}

Expand Down

0 comments on commit 9a397ea

Please sign in to comment.