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`.
This commit is contained in:
Mahmoud Al-Qudsi 2024-06-21 11:43:31 -05:00
parent e0266067c4
commit 7d1942a023

View File

@ -72,9 +72,16 @@ math '-10^15'
# CHECK: 100000000000000 # CHECK: 100000000000000
# CHECK: -1000000000000000 # 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 math -2^2
# CHECK: 1.316074
# CHECK: 4 # CHECK: 4
math -s0 '1.0 / 2.0' math -s0 '1.0 / 2.0'
@ -280,7 +287,7 @@ math pow sin 3, 5 + 2
# CHECKERR: ^~~~^ # CHECKERR: ^~~~^
math sin pow 3, 5 math sin pow 3, 5
# CHECK: -0.890009 # CHECK: {{-0\.890009|-0.890\d*}}
math pow 2, cos -pi math pow 2, cos -pi
# CHECK: 0.5 # CHECK: 0.5