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
This commit is contained in:
riastradh 2024-05-11 20:09:47 +00:00
parent 0ca3b42cb3
commit 806be69ba7
2 changed files with 5 additions and 10 deletions

View File

@ -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;

View File

@ -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;