Skip to content

Commit 9a397ea

Browse files
macros...
1 parent 064357f commit 9a397ea

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

tests/pass/float.rs

+2-4
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,6 @@ use std::fmt::{Debug, Display, LowerHex};
1212
use std::hint::black_box;
1313
use std::{f32, f64};
1414

15-
// accept up to 64ULP (16ULP for host floats and 16ULP for artificial error and 32 for any rounding errors)
16-
const ALLOWED_ULP_DIFF: i128 = 64;
17-
1815
/// Another form of checking if 2 floating point numbers are almost equal to eachother
1916
/// Using `a` and `b` as floating point numbers:
2017
///
@@ -74,7 +71,8 @@ macro_rules! assert_approx_eq {
7471
}};
7572

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

0 commit comments

Comments
 (0)