Module Name: src
Committed By: riastradh
Date: Sat May 11 20:09:47 UTC 2024
Modified Files:
src/lib/libm/src: e_hypotl.c
src/tests/lib/libm: t_hypot.c
Log Message:
hypotl(3): Fix includes and macros.
1. Need <math.h> for __HAVE_LONG_DOUBLE.
2. Need <machine/ieee.h> for struct ieee_ext_u &c.
3. EXT_FRACLBITS, not LDBL_MANL_SIZE.
PR lib/58245: hypotl is broken on ld128 ports
To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/lib/libm/src/e_hypotl.c
cvs rdiff -u -r1.4 -r1.5 src/tests/lib/libm/t_hypot.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/e_hypotl.c
diff -u src/lib/libm/src/e_hypotl.c:1.1 src/lib/libm/src/e_hypotl.c:1.2
--- src/lib/libm/src/e_hypotl.c:1.1 Sun Jan 21 18:53:18 2024
+++ src/lib/libm/src/e_hypotl.c Sat May 11 20:09:47 2024
@@ -16,6 +16,9 @@
#include <float.h>
+#include <math.h>
+
+#include <machine/ieee.h>
__weak_alias(hypotl, _hypotl)
@@ -45,7 +48,7 @@ __weak_alias(hypotl, _hypotl)
#define MANT_DIG LDBL_MANT_DIG
#define MAX_EXP LDBL_MAX_EXP
-#if LDBL_MANL_SIZE > 32
+#if EXT_FRACLBITS > 32
typedef uint64_t man_t;
#else
typedef uint32_t man_t;
Index: src/tests/lib/libm/t_hypot.c
diff -u src/tests/lib/libm/t_hypot.c:1.4 src/tests/lib/libm/t_hypot.c:1.5
--- src/tests/lib/libm/t_hypot.c:1.4 Sat May 11 20:09:13 2024
+++ src/tests/lib/libm/t_hypot.c Sat May 11 20:09:47 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: t_hypot.c,v 1.4 2024/05/11 20:09:13 riastradh Exp $ */
+/* $NetBSD: t_hypot.c,v 1.5 2024/05/11 20:09:47 riastradh Exp $ */
/*-
* Copyright (c) 2016 The NetBSD Foundation, Inc.
@@ -265,10 +265,6 @@ ATF_TC_BODY(hypotl_trivial, tc)
CHECKL_EQ(i, hypotl, -0.L, -x, x);
}
-#if __HAVE_LONG_DOUBLE + 0 == 128
- atf_tc_expect_fail("PR lib/58245: hypotl is broken on ld128 ports");
-#endif
-
for (i = 0; i < __arraycount(trivial_casesl); i++) {
volatile long double x = trivial_casesl[i];
@@ -457,10 +453,6 @@ ATF_TC_BODY(hypotl_exact, tc)
}
}
-#if __HAVE_LONG_DOUBLE + 0 == 128
- atf_tc_expect_fail("PR lib/58245: hypotl is broken on ld128 ports");
-#endif
-
#if LDBL_MANT_DIG >= 64
for (i = 0; i < __arraycount(exact_casesl); i++) {
int s;