mirror of
https://github.com/rizinorg/rizin
synced 2026-08-22 20:26:16 -04:00
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:
parent
842cde6138
commit
0d362aab25
1 changed files with 6 additions and 2 deletions
|
|
@ -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
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue