From 7d1942a023dd0d522e50209581e2cbd400a78a30 Mon Sep 17 00:00:00 2001 From: Mahmoud Al-Qudsi Date: Fri, 21 Jun 2024 11:43:31 -0500 Subject: [PATCH] Add reduced-accuracy variants of some math tests under x86 Due to the inherent floating point accuracy issues under i586 described in #10474 and at https://github.com/rust-lang/rust/issues/114479, we need to add a workaround to our littlecheck math tests to perform less stringent comparisons when fish was built for x86 without SSE2 support. This commit addresses the littlecheck issues that caused #10474 to be re-opened, but I still have to reproduce the cargo test failures for `negative_precision_width`, `test_float`, `test_float_g`, and `test_locale`. --- tests/checks/math.fish | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/tests/checks/math.fish b/tests/checks/math.fish index bcfadd955..9c6f8e34e 100644 --- a/tests/checks/math.fish +++ b/tests/checks/math.fish @@ -72,9 +72,16 @@ math '-10^15' # CHECK: 100000000000000 # CHECK: -1000000000000000 -math 3^0.5^2 +# Floating point operations under x86 without SSE2 have reduced accuracy! +# This includes both i586 targets and i686 under Debian, where it's patched to remove SSE2. +# As a result, some floating point tests use regular expressions to loosely match against +# the shape of the expected result. + +# NB: The i586 case should also pass under other platforms, but not the other way around. +math "3^0.5^2" +# CHECK: {{1\.316074|1\.316\d+}} + math -2^2 -# CHECK: 1.316074 # CHECK: 4 math -s0 '1.0 / 2.0' @@ -280,7 +287,7 @@ math pow sin 3, 5 + 2 # CHECKERR: ^~~~^ math sin pow 3, 5 -# CHECK: -0.890009 +# CHECK: {{-0\.890009|-0.890\d*}} math pow 2, cos -pi # CHECK: 0.5