NetBSD Problem Report #58054

From martin@duskware.de  Tue Mar 19 19:03:54 2024
Return-Path: <martin@duskware.de>
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 5F1F51A9239
	for <gnats-bugs@gnats.NetBSD.org>; Tue, 19 Mar 2024 19:03:54 +0000 (UTC)
From: martin@NetBSD.org
Reply-To: martin
To: gnats-bugs@NetBSD.org
Subject: libm nearbyint() broken
X-Send-Pr-Version: 3.95

>Number:         58054
>Category:       lib
>Synopsis:       libm nearbyint() broken
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    lib-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Mar 19 19:05:00 +0000 2024
>Last-Modified:  Thu May 09 12:20:01 +0000 2024
>Originator:     Martin Husemann
>Release:        NetBSD 10.99.10
>Organization:
The NetBSD Foundation, Inc.
>Environment:
System: NetBSD thirdstage.duskware.de 10.99.10 NetBSD 10.99.10 (MODULAR) #699: Tue Mar 19 12:19:16 CET 2024 martin@thirdstage.duskware.de:/usr/src/sys/arch/sparc64/compile/MODULAR sparc64
Architecture: sparc64
Machine: sparc64
>Description:

The changes in 


Date: Sat, 24 Feb 2024 10:16:53 -0500
From: Christos Zoulas <christos@netbsd.org>
To: source-changes@NetBSD.org   
Subject: CVS commit: src/lib/libm/src
X-Mailer: log_accum

Module Name:    src
Committed By:   christos
Date:           Sat Feb 24 15:16:53 UTC 2024

Modified Files: 
        src/lib/libm/src: b_tgammal.c e_acoshl.c e_acosl.c e_asinl.c e_atanhl.c
            s_asinhl.c s_atanl.c s_cospil.c s_erfl.c s_exp2l.c s_fabsl.c
            s_llrintl.c s_logl.c s_lrintl.c s_nearbyint.c s_remquol.c
            s_sincosl.c s_sinpil.c s_tanhl.c s_tanpil.c

Log Message: 
add missing symbols for non long double architectures.


To generate a diff of this commit: 
cvs rdiff -u -r1.2 -r1.3 src/lib/libm/src/b_tgammal.c \
    src/lib/libm/src/e_acoshl.c src/lib/libm/src/e_acosl.c \
    src/lib/libm/src/e_asinl.c src/lib/libm/src/e_atanhl.c \
    src/lib/libm/src/s_asinhl.c src/lib/libm/src/s_cospil.c \
    src/lib/libm/src/s_erfl.c src/lib/libm/src/s_exp2l.c \
    src/lib/libm/src/s_sincosl.c src/lib/libm/src/s_sinpil.c \
    src/lib/libm/src/s_tanhl.c src/lib/libm/src/s_tanpil.c
cvs rdiff -u -r1.3 -r1.4 src/lib/libm/src/s_atanl.c \
    src/lib/libm/src/s_llrintl.c src/lib/libm/src/s_logl.c \
    src/lib/libm/src/s_lrintl.c src/lib/libm/src/s_remquol.c
cvs rdiff -u -r1.4 -r1.5 src/lib/libm/src/s_fabsl.c \
    src/lib/libm/src/s_nearbyint.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.


broke nearbyint() on sparc64:

tc-start: 1710874843.919690, fe_nearbyint
tc-se:*** Check failed: /usr/src/tests/lib/libm/t_fe_round.c:110: nearbyint rounding wrong, difference too large
tc-se:input: 3.700000 (index 0): got 3.500000, expected 3
tc-se:
tc-se:*** Check failed: /usr/src/tests/lib/libm/t_fe_round.c:110: nearbyint rounding wrong, difference too large
tc-se:input: -3.700001 (index 1): got -3.750000, expected -4
tc-se:
tc-se:*** Check failed: /usr/src/tests/lib/libm/t_fe_round.c:110: nearbyint rounding wrong, difference too large
tc-se:input: -9223.010001 (index 3): got -9223.000000, expected -9224
tc-se:
tc-se:*** Check failed: /usr/src/tests/lib/libm/t_fe_round.c:110: nearbyint rounding wrong, difference too large
...

>How-To-Repeat:

cd /usr/tests/lib/libm && atf-run t_fe_round

>Fix:
n/a

>Audit-Trail:
From: "Christos Zoulas" <christos@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/58054 CVS commit: src/lib/libm/src
Date: Tue, 2 Apr 2024 14:39:51 -0400

 Module Name:	src
 Committed By:	christos
 Date:		Tue Apr  2 18:39:51 UTC 2024

 Modified Files:
 	src/lib/libm/src: s_fabsl.c s_rintl.c

 Log Message:
 PR/58054: Martin Husemann: fix bug in expsign extraction and only use the
 code for the floating point formats where it works (does not work for 112
 bit mantisa in sparc64)


 To generate a diff of this commit:
 cvs rdiff -u -r1.6 -r1.7 src/lib/libm/src/s_fabsl.c
 cvs rdiff -u -r1.5 -r1.6 src/lib/libm/src/s_rintl.c

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

From: "Taylor R Campbell" <riastradh@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/58054 CVS commit: src/tests/lib/libm
Date: Thu, 2 May 2024 16:51:55 +0000

 Module Name:	src
 Committed By:	riastradh
 Date:		Thu May  2 16:51:55 UTC 2024

 Modified Files:
 	src/tests/lib/libm: t_fe_round.c

 Log Message:
 tests/lib/libm/t_fe_round: Tidy up nearbyintl, sync nearbyint test.

 PR lib/58054


 To generate a diff of this commit:
 cvs rdiff -u -r1.13 -r1.14 src/tests/lib/libm/t_fe_round.c

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

From: "Taylor R Campbell" <riastradh@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/58054 CVS commit: src/tests/lib/libm
Date: Thu, 2 May 2024 16:52:08 +0000

 Module Name:	src
 Committed By:	riastradh
 Date:		Thu May  2 16:52:08 UTC 2024

 Modified Files:
 	src/tests/lib/libm: t_fe_round.c

 Log Message:
 tests/lib/libm/t_fe_round: Fix a missed cast.

 Need long long or intmax_t, not long, on LP32.

 PR lib/58054


 To generate a diff of this commit:
 cvs rdiff -u -r1.14 -r1.15 src/tests/lib/libm/t_fe_round.c

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

From: "Taylor R Campbell" <riastradh@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/58054 CVS commit: src/tests/lib/libm
Date: Fri, 3 May 2024 21:40:52 +0000

 Module Name:	src
 Committed By:	riastradh
 Date:		Fri May  3 21:40:52 UTC 2024

 Modified Files:
 	src/tests/lib/libm: t_fe_round.c

 Log Message:
 tests/lib/libm/t_fe_round.c: Expand nearbyint/rint tests.

 PR lib/58054


 To generate a diff of this commit:
 cvs rdiff -u -r1.15 -r1.16 src/tests/lib/libm/t_fe_round.c

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

From: "Taylor R Campbell" <riastradh@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/58054 CVS commit: src/lib/libm/src
Date: Sat, 4 May 2024 19:21:51 +0000

 Module Name:	src
 Committed By:	riastradh
 Date:		Sat May  4 19:21:51 UTC 2024

 Modified Files:
 	src/lib/libm/src: s_rintl.c

 Log Message:
 s_rintl.c: Reduce FreeBSD diff and fix on ld128 platforms.

 EXT_FRACBITS, the number of bits in the _binary encoding_ that stores
 the trailing significand field, is never 113.  In IEEE 754 binary128,
 it is 112, even though there are 113 bits of precision in the set of
 floating-point numbers -- the leading 1 bit is implicit in binary128.
 So ld128 platforms like aarch64 and sparc64 were skipping the real
 definition and just defining rintl as an alias for rint, which is
 wrong.

 In contrast, LDBL_MANT_DIG, the number of bits of precision in the set
 of floating-point numbers (p, in IEEE 754 parlance), is 113 in IEEE 754
 binary128.  This is also the constant used in FreeBSD libm anyway.  So
 let's just use that instead of trying to translate it to our private
 EXT_FRACBITS (not defined in FreeBSD) with a fencepos terror.  And
 delete the buggy rintl=rint alias.

 PR lib/58054


 To generate a diff of this commit:
 cvs rdiff -u -r1.6 -r1.7 src/lib/libm/src/s_rintl.c

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

From: "Taylor R Campbell" <riastradh@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/58054 CVS commit: src
Date: Sun, 5 May 2024 02:50:11 +0000

 Module Name:	src
 Committed By:	riastradh
 Date:		Sun May  5 02:50:11 UTC 2024

 Modified Files:
 	src: UPDATING
 	src/lib/libm: Makefile
 Added Files:
 	src/lib/libm/arch/i387: s_rintl.S

 Log Message:
 libm: New s_rintl.S for x86.

 Prompted by PR lib/58054.


 To generate a diff of this commit:
 cvs rdiff -u -r1.349 -r1.350 src/UPDATING
 cvs rdiff -u -r1.227 -r1.228 src/lib/libm/Makefile
 cvs rdiff -u -r0 -r1.1 src/lib/libm/arch/i387/s_rintl.S

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

From: "Taylor R Campbell" <riastradh@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/58054 CVS commit: src/lib/libm
Date: Sun, 5 May 2024 11:07:49 +0000

 Module Name:	src
 Committed By:	riastradh
 Date:		Sun May  5 11:07:49 UTC 2024

 Modified Files:
 	src/lib/libm: Makefile

 Log Message:
 libm: long double is just double on arm, so don't use s_rintl.c.

 PR misc/58054


 To generate a diff of this commit:
 cvs rdiff -u -r1.228 -r1.229 src/lib/libm/Makefile

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

From: "Taylor R Campbell" <riastradh@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/58054 CVS commit: src/lib/libm
Date: Sun, 5 May 2024 22:52:19 +0000

 Module Name:	src
 Committed By:	riastradh
 Date:		Sun May  5 22:52:19 UTC 2024

 Modified Files:
 	src/lib/libm: Makefile

 Log Message:
 libm: long double is just double on hppa, so don't use s_rintl.c.

 PR misc/58054


 To generate a diff of this commit:
 cvs rdiff -u -r1.230 -r1.231 src/lib/libm/Makefile

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

From: "Taylor R Campbell" <riastradh@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/58054 CVS commit: src/tests/lib/libm
Date: Thu, 9 May 2024 12:18:28 +0000

 Module Name:	src
 Committed By:	riastradh
 Date:		Thu May  9 12:18:28 UTC 2024

 Modified Files:
 	src/tests/lib/libm: t_fe_round.c

 Log Message:
 tests/lib/libm/t_fe_round.c: Tidy.

 nextafter/nexttoward tests didn't make much sense, and are now
 supplanted by t_next.

 PR misc/58054


 To generate a diff of this commit:
 cvs rdiff -u -r1.18 -r1.19 src/tests/lib/libm/t_fe_round.c

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

NetBSD Home
NetBSD PR Database Search

(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.