NetBSD Problem Report #58242
From www@netbsd.org Sat May 11 01:36:15 2024
Return-Path: <www@netbsd.org>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits))
(Client CN "mail.NetBSD.org", Issuer "mail.NetBSD.org CA" (not verified))
by mollari.NetBSD.org (Postfix) with ESMTPS id EFD491A9247
for <gnats-bugs@gnats.NetBSD.org>; Sat, 11 May 2024 01:36:14 +0000 (UTC)
Message-Id: <20240511013613.4A16F1A9248@mollari.NetBSD.org>
Date: Sat, 11 May 2024 01:36:13 +0000 (UTC)
From: campbell+netbsd@mumble.net
Reply-To: campbell+netbsd@mumble.net
To: gnats-bugs@NetBSD.org
Subject: lib/libm/t_fenv tests compute bogus expected results
X-Send-Pr-Version: www-1.0
>Number: 58242
>Category: port-alpha
>Synopsis: lib/libm/t_fenv tests compute bogus expected results
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: thorpej
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Sat May 11 01:40:00 +0000 2024
>Last-Modified: Sat May 11 01:46:30 +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:/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!
>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: port-alpha-maintainer->thorpej
Responsible-Changed-By: thorpej@NetBSD.org
Responsible-Changed-When: Sat, 11 May 2024 01:46:30 +0000
Responsible-Changed-Why:
I'll drag out the beast and have a look.
>Unformatted:
(Contact us)
$NetBSD: query-full-pr,v 1.47 2022/09/11 19:34:41 kim Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2024
The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.