NetBSD Problem Report #58237

From www@netbsd.org  Wed May  8 22:46:56 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 1127A1A9238
	for <gnats-bugs@gnats.NetBSD.org>; Wed,  8 May 2024 22:46:56 +0000 (UTC)
Message-Id: <20240508224654.D60A31A923B@mollari.NetBSD.org>
Date: Wed,  8 May 2024 22:46:54 +0000 (UTC)
From: campbell+netbsd@mumble.net
Reply-To: campbell+netbsd@mumble.net
To: gnats-bugs@NetBSD.org
Subject: modfl returns wrong answers on ld128 architectures
X-Send-Pr-Version: www-1.0

>Number:         58237
>Category:       lib
>Synopsis:       modfl returns wrong answers on ld128 architectures
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    lib-bug-people
>State:          needs-pullups
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed May 08 22:50:00 +0000 2024
>Closed-Date:    
>Last-Modified:  Tue Jul 23 21:15:35 +0000 2024
>Originator:     Taylor R Campbell
>Release:        current, 10, 9, ...
>Organization:
The NetBSD Modflation
>Environment:
>Description:
f = modfl(x, &i) is supposed to set f to be a fractional part lying in [0,1) and i to be an integer.

But on ld128 architectures such as aarch64, it fails to do this in some cases.  For example, for 1 + FLT_EPSILON (that is, 1 + 2^{-23}), it returns f = 0 and i = 1 + 2^{-23}.
>How-To-Repeat:
long double i, f;

f = modfl(1 + FLT_EPSILON, &i);

For example:

https://releng.netbsd.org/b5reports/evbarm-aarch64/2024/2024.05.08.02.08.11/test.html#lib_libm_t_modf_modfl
>Fix:
Yes, please!

>Release-Note:

>Audit-Trail:
From: "Taylor R Campbell" <riastradh@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/58237 CVS commit: src/tests/lib/libm
Date: Wed, 8 May 2024 22:57:38 +0000

 Module Name:	src
 Committed By:	riastradh
 Date:		Wed May  8 22:57:38 UTC 2024

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

 Log Message:
 tests/lib/libm/t_modf: Mark modfl xfail on ld128.

 PR lib/58237: modfl returns wrong answers on ld128 architectures


 To generate a diff of this commit:
 cvs rdiff -u -r1.4 -r1.5 src/tests/lib/libm/t_modf.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/58237 CVS commit: src/tests/lib/libm
Date: Wed, 8 May 2024 22:59:07 +0000

 Module Name:	src
 Committed By:	riastradh
 Date:		Wed May  8 22:59:07 UTC 2024

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

 Log Message:
 tests/lib/libm/t_fe_round: xfail for modfl uses.

 PR lib/58237: modfl returns wrong answers on ld128 architectures


 To generate a diff of this commit:
 cvs rdiff -u -r1.17 -r1.18 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/58237 CVS commit: src
Date: Wed, 15 May 2024 00:02:57 +0000

 Module Name:	src
 Committed By:	riastradh
 Date:		Wed May 15 00:02:57 UTC 2024

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

 Log Message:
 modfl(3): Fix conversion from FreeBSD.

 LDBL_MANL_SIZE is spelled EXT_FRACLBITS -- and not EXT_FRACHBITS.

 PR lib/58237: modfl returns wrong answers on ld128 architectures


 To generate a diff of this commit:
 cvs rdiff -u -r1.1 -r1.2 src/lib/libm/src/s_modfl.c
 cvs rdiff -u -r1.19 -r1.20 src/tests/lib/libm/t_fe_round.c
 cvs rdiff -u -r1.5 -r1.6 src/tests/lib/libm/t_modf.c

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

State-Changed-From-To: open->needs-pullups
State-Changed-By: riastradh@NetBSD.org
State-Changed-When: Tue, 23 Jul 2024 21:15:35 +0000
State-Changed-Why:
fixed in HEAD, needs pullup-10, pullup-9


>Unformatted:

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.