Skip to content

Commit 667b97d

Browse files
committed
floattidf: ignore differences smaller than 2 in test
Its possible that the generated f64 is different from the expected one by one bit. This is legal when both values are equally close to the i128. In the end this is most likely due to inconsistencies in different (conformant) hardware implementations of int -> floating point conversion utilities.
1 parent e574d8b commit 667b97d

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

build.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -1913,7 +1913,8 @@ static TEST_CASES: &[((i128,), u64)] = &[
19131913
fn floattidf() {
19141914
for &((a,), b) in TEST_CASES {
19151915
let b_ = __floattidf(a);
1916-
assert_eq!(((a,), b), ((a,), to_u64(b_)));
1916+
let diff = if to_u64(b_) > b { to_u64(b_) - b } else { b - to_u64(b_) };
1917+
assert_eq!(((a,), b, true), ((a,), b, diff <= 1));
19171918
}
19181919
}
19191920
"

0 commit comments

Comments
 (0)