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.

Modified files:

Index: src/lib/libm/src/s_modfl.c
diff -u src/lib/libm/src/s_modfl.c:1.1 src/lib/libm/src/s_modfl.c:1.2
--- src/lib/libm/src/s_modfl.c:1.1	Mon Jun 16 12:54:43 2014
+++ src/lib/libm/src/s_modfl.c	Wed May 15 00:02:56 2024
@@ -36,7 +36,7 @@
  * $FreeBSD: head/lib/msun/src/s_modfl.c 165855 2007-01-07 07:54:21Z das $
  */
 #include <sys/cdefs.h>
-__RCSID("$NetBSD: s_modfl.c,v 1.1 2014/06/16 12:54:43 joerg Exp $");
+__RCSID("$NetBSD: s_modfl.c,v 1.2 2024/05/15 00:02:56 riastradh Exp $");
 
 #include "namespace.h"
 
@@ -51,7 +51,7 @@ __RCSID("$NetBSD: s_modfl.c,v 1.1 2014/0
 __weak_alias(modfl, _modfl)
 #endif
 
-#if LDBL_MANL_SIZE > 32
+#if EXT_FRACLBITS > 32
 #define	MASK	((uint64_t)-1)
 #else
 #define	MASK	((uint32_t)-1)
@@ -59,7 +59,7 @@ __weak_alias(modfl, _modfl)
 /* Return the last n bits of a word, representing the fractional part. */
 #define	GETFRAC(bits, n)	((bits) & ~(MASK << (n)))
 /* The number of fraction bits in manh, not counting the integer bit */
-#define	HIBITS	(LDBL_MANT_DIG - EXT_FRACHBITS)
+#define	HIBITS	(LDBL_MANT_DIG - EXT_FRACLBITS)
 
 static const long double zero[] = { 0.0L, -0.0L };
 

Index: src/tests/lib/libm/t_fe_round.c
diff -u src/tests/lib/libm/t_fe_round.c:1.19 src/tests/lib/libm/t_fe_round.c:1.20
--- src/tests/lib/libm/t_fe_round.c:1.19	Thu May  9 12:18:28 2024
+++ src/tests/lib/libm/t_fe_round.c	Wed May 15 00:02:57 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_fe_round.c,v 1.19 2024/05/09 12:18:28 riastradh Exp $	*/
+/*	$NetBSD: t_fe_round.c,v 1.20 2024/05/15 00:02:57 riastradh Exp $	*/
 
 /*
  * Written by Maya Rashish <m...@netbsd.org>
@@ -8,7 +8,7 @@
  */
 
 #include <sys/cdefs.h>
-__RCSID("$NetBSD: t_fe_round.c,v 1.19 2024/05/09 12:18:28 riastradh Exp $");
+__RCSID("$NetBSD: t_fe_round.c,v 1.20 2024/05/15 00:02:57 riastradh Exp $");
 
 #include <atf-c.h>
 #include <fenv.h>
@@ -400,12 +400,6 @@ ATF_TC_BODY(fe_nearbyintl_rintl, tc)
 				    fnname[fn], valuesl[i].input);
 			}
 
-#if __HAVE_LONG_DOUBLE + 0 == 128
-			atf_tc_expect_fail("PR lib/58237:"
-			    " modfl returns wrong answers"
-			    " on ld128 architectures");
-#endif
-
 			/*
 			 * Verify the fractional part of the result is
 			 * zero -- the result of rounding to an integer

Index: src/tests/lib/libm/t_modf.c
diff -u src/tests/lib/libm/t_modf.c:1.5 src/tests/lib/libm/t_modf.c:1.6
--- src/tests/lib/libm/t_modf.c:1.5	Wed May  8 22:57:37 2024
+++ src/tests/lib/libm/t_modf.c	Wed May 15 00:02:57 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_modf.c,v 1.5 2024/05/08 22:57:37 riastradh Exp $	*/
+/*	$NetBSD: t_modf.c,v 1.6 2024/05/15 00:02:57 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__RCSID("$NetBSD: t_modf.c,v 1.5 2024/05/08 22:57:37 riastradh Exp $");
+__RCSID("$NetBSD: t_modf.c,v 1.6 2024/05/15 00:02:57 riastradh Exp $");
 
 #include <atf-c.h>
 #include <float.h>
@@ -289,11 +289,6 @@ ATF_TC_BODY(modfl, tc)
 {
 	unsigned n;
 
-#if __HAVE_LONG_DOUBLE + 0 == 128
-	atf_tc_expect_fail("PR lib/58237:"
-	    " modfl returns wrong answers on ld128 architectures");
-#endif
-
 	for (n = 0; n < __arraycount(casesf); n++) {
 		long double x, i, f;
 

Reply via email to