test: do not pin a libm pow() result to full precision

% 2**4.5 asserted both the %.17g rendering and the exact bit pattern of
pow(2.0, 4.5). The exact value is 22.62741699796952078...; glibc and the
UCRT return the correctly rounded 0x4036a09e667f3bcd, while FreeBSD and
NetBSD return 0x4036a09e667f3bcc, one ULP low. msun's pow is documented as
under one ULP, not correctly rounded, so the test asserted bit-exact libm
behaviour for a transcendental and could not pass everywhere.

Filter the output down to the rounded line, which every implementation
within one ULP agrees on. The full float/scifmt/hex table stays covered by
the tests whose results are exactly representable.
This commit is contained in:
Anton Kochkov 2026-07-24 03:07:01 +00:00 committed by Florian Märkl
parent 842cde6138
commit 0d362aab25

View file

@ -273,10 +273,14 @@ RUN
NAME="% 2**4.5"
FILE=--
CMDS=% 2**4.5
# pow() is not correctly rounded on every libm. FreeBSD and NetBSD (msun)
# return 22.627416997969519, one ULP below the correctly rounded
# 22.627416997969522 that glibc and the UCRT give, so scifmt and hex cannot
# be pinned here. Assert the rounded line, which any implementation within
# one ULP agrees on.
REGEXP_FILTER_OUT=float[[:space:]]+22\.6274
EXPECT=<<EOF
float 22.6274
scifmt 22.627416997969522
hex 0x4036a09e667f3bcd
EOF
RUN