NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

port-alpha/58242: lib/libm/t_fenv tests compute bogus expected results



>Number:         58242
>Category:       port-alpha
>Synopsis:       lib/libm/t_fenv tests compute bogus expected results
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    port-alpha-maintainer
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat May 11 01:40:00 +0000 2024
>Originator:     Taylor R Campbell
>Release:        current
>Organization:
The NetBSD Fegetroundalphation
>Environment:
QEMU emulator version 8.2.2
NetBSD 10.99.10 (GENERIC-$Revision: 1.421 $) #0: Fri May 10 16:14:42 UTC 2024
 root%babylon5.netbsd.org@localhost:/tmp/build/2024.05.10.14.42.21-alpha/obj/sys/arch/alpha/compile/GENERIC
AlphaServer ES40 ("Clipper"), 250MHz, s/n QEMU

>Description:
https://releng.netbsd.org/b5reports/alpha/2024/2024.05.10.14.42.21/test.html#lib_libm_t_fenv_fegetround

*** Check failed: /tmp/build/2024.05.10.14.42.21-alpha/src/tests/lib/libm/t_fenv.c:154: y1 != z1: FE_TOWARDZERO[-1 + ulp(1)/4] expected=-0x1p+0 actual=-0x1.fffffffffffffp-1
*** Check failed: /tmp/build/2024.05.10.14.42.21-alpha/src/tests/lib/libm/t_fenv.c:156: y2 != z2: FE_TOWARDZERO[1 + 3*(ulp(1)/2)] expected=0x1.0000000000002p+0 actual=0x1.0000000000001p+0
*** Check failed: /tmp/build/2024.05.10.14.42.21-alpha/src/tests/lib/libm/t_fenv.c:156: y2 != z2: FE_DOWNWARD[1 + 3*(ulp(1)/2)] expected=0x1.0000000000002p+0 actual=0x1.0000000000001p+0
*** Check failed: /tmp/build/2024.05.10.14.42.21-alpha/src/tests/lib/libm/t_fenv.c:154: y1 != z1: FE_UPWARD[-1 + ulp(1)/4] expected=-0x1p+0 actual=-0x1.fffffffffffffp-1

The _expected_ values are wrong:

- In the first failure, of FE_TOWARDZERO[-1 + ulp(1)/4], the expected value is -1 + DBL_EPSILON/2, which should be computed exactly without rounding giving -0x1.fffffffffffffp-1 in IEEE 754 binary64, but it is printed as -0x1p+0 instead.  In contrast, the actual value is correct.
- In the second failure, of FE_TOWARDZERO[1 + 3*ulp(1)/2], the expected value is 1 + DBL_EPSILON, which again should be computed exactly without rounding giving 0x1.0000000000001p+0 in IEEE 754 binary64, but it is printed as 0x1.0000000000002p+0 instead.  In contrast, the actual value is correct.

It is possible this is a qemu bug, not a NetBSD bug or alpha bug.
>How-To-Repeat:
cd /usr/tests/lib/libm
atf-run t_fenv | atf-report
>Fix:
Yes, please!



Home | Main Index | Thread Index | Old Index