Module Name: src Committed By: kre Date: Mon Jan 22 12:15:19 UTC 2024
Modified Files: src/include: math.h src/lib/libm/ld80: b_expl.c b_logl.c b_tgammal.c src/lib/libm/src: math_private.h s_atanl.c s_remquol.c Log Message: This set of changes seem to be sufficient to make at least the amd64 port build again after the long double math function infusion from yesterday. Feel free (without consulting me, I'm just hacking about) to revert any of this and do it a better way. Note: this is not intended to be complete, in particular, in <math.h> I added prototypes only for the functions that are needed for a successful build, not all of the new ones... To generate a diff of this commit: cvs rdiff -u -r1.67 -r1.68 src/include/math.h cvs rdiff -u -r1.1 -r1.2 src/lib/libm/ld80/b_expl.c \ src/lib/libm/ld80/b_logl.c src/lib/libm/ld80/b_tgammal.c cvs rdiff -u -r1.28 -r1.29 src/lib/libm/src/math_private.h cvs rdiff -u -r1.1 -r1.2 src/lib/libm/src/s_atanl.c \ src/lib/libm/src/s_remquol.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/include/math.h diff -u src/include/math.h:1.67 src/include/math.h:1.68 --- src/include/math.h:1.67 Sat Aug 27 08:31:59 2022 +++ src/include/math.h Mon Jan 22 12:15:19 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: math.h,v 1.67 2022/08/27 08:31:59 christos Exp $ */ +/* $NetBSD: math.h,v 1.68 2024/01/22 12:15:19 kre Exp $ */ /* * ==================================================== @@ -591,6 +591,21 @@ int __isnanl(long double); int __signbitl(long double); #endif +/* XXX: Probable temporary hacks for new math functions - 20240122 */ +double cospi(double); +float cospif(float); +double sinpi(double); +float sinpif(float); +double tanpi(double); +float tanpif(float); + +#ifdef __HAVE_LONG_DOUBLE +long double cospil(long double); +long double lgammal_r(long double, int *); +long double sinpil(long double); +long double tanpil(long double); +#endif + __END_DECLS #endif /* _MATH_H_ */ Index: src/lib/libm/ld80/b_expl.c diff -u src/lib/libm/ld80/b_expl.c:1.1 src/lib/libm/ld80/b_expl.c:1.2 --- src/lib/libm/ld80/b_expl.c:1.1 Sun Jan 21 18:53:16 2024 +++ src/lib/libm/ld80/b_expl.c Mon Jan 22 12:15:19 2024 @@ -29,6 +29,7 @@ * SUCH DAMAGE. */ +#include <sys/cdefs.h> /* * See bsdsrc/b_exp.c for implementation details. * Index: src/lib/libm/ld80/b_logl.c diff -u src/lib/libm/ld80/b_logl.c:1.1 src/lib/libm/ld80/b_logl.c:1.2 --- src/lib/libm/ld80/b_logl.c:1.1 Sun Jan 21 18:53:16 2024 +++ src/lib/libm/ld80/b_logl.c Mon Jan 22 12:15:19 2024 @@ -29,12 +29,16 @@ * SUCH DAMAGE. */ +#include <sys/cdefs.h> + /* * See bsdsrc/b_log.c for implementation details. * * bsdrc/b_log.c converted to long double by Steven G. Kargl. */ +#include "math_private.h" + #define N 128 /* Index: src/lib/libm/ld80/b_tgammal.c diff -u src/lib/libm/ld80/b_tgammal.c:1.1 src/lib/libm/ld80/b_tgammal.c:1.2 --- src/lib/libm/ld80/b_tgammal.c:1.1 Sun Jan 21 18:53:16 2024 +++ src/lib/libm/ld80/b_tgammal.c Mon Jan 22 12:15:19 2024 @@ -41,6 +41,8 @@ * bsdrc/b_tgamma.c converted to long double by Steven G. Kargl. */ +#include <sys/cdefs.h> + /* * See bsdsrc/t_tgamma.c for implementation details. */ Index: src/lib/libm/src/math_private.h diff -u src/lib/libm/src/math_private.h:1.28 src/lib/libm/src/math_private.h:1.29 --- src/lib/libm/src/math_private.h:1.28 Sun Jan 21 18:53:18 2024 +++ src/lib/libm/src/math_private.h Mon Jan 22 12:15:19 2024 @@ -11,7 +11,7 @@ /* * from: @(#)fdlibm.h 5.1 93/09/24 - * $NetBSD: math_private.h,v 1.28 2024/01/21 18:53:18 christos Exp $ + * $NetBSD: math_private.h,v 1.29 2024/01/22 12:15:19 kre Exp $ */ #ifndef _MATH_PRIVATE_H_ @@ -318,10 +318,10 @@ do { \ #ifdef __i386__ /* Long double constants are broken on i386. */ #define LD80C(m, ex, v) { \ - .extu_fracl = __CONCAT(m, ULL); \ - .extu_frach = __CONCAT(m, ULL) >> EXT_FRACLBITS; \ - .extu_exp = (0x3fff + (ex)) | ((v) < 0 ? 0x8000 : 0), \ - .extu_sign = (0x3fff + (ex)) | ((v) < 0 ? 0x8000 : 0) >> EXP_EXPBITS,\ + .extu_fracl = (uint32_t)(__CONCAT(m, ULL)), \ + .extu_frach = __CONCAT(m, ULL) >> EXT_FRACLBITS, \ + .extu_exp = (0x3fff + (ex)), \ + .extu_sign = ((v) < 0 ? 0x8000 : 0) >> EXT_EXPBITS, \ } #else /* The above works on non-i386 too, but we use this to check v. */ Index: src/lib/libm/src/s_atanl.c diff -u src/lib/libm/src/s_atanl.c:1.1 src/lib/libm/src/s_atanl.c:1.2 --- src/lib/libm/src/s_atanl.c:1.1 Sun Jan 21 18:53:18 2024 +++ src/lib/libm/src/s_atanl.c Mon Jan 22 12:15:19 2024 @@ -15,6 +15,9 @@ #include <float.h> +#include "math.h" +#include "math_private.h" + #ifdef __HAVE_LONG_DOUBLE __weak_alias(atanl, _atanl) @@ -31,8 +34,6 @@ __weak_alias(atanl, _atanl) #else #error "Unsupported long double format" #endif -#include "math.h" -#include "math_private.h" #ifdef LDBL_IMPLICIT_NBIT #define LDBL_NBIT 0 Index: src/lib/libm/src/s_remquol.c diff -u src/lib/libm/src/s_remquol.c:1.1 src/lib/libm/src/s_remquol.c:1.2 --- src/lib/libm/src/s_remquol.c:1.1 Sun Jan 21 18:53:19 2024 +++ src/lib/libm/src/s_remquol.c Mon Jan 22 12:15:19 2024 @@ -13,11 +13,11 @@ #include <float.h> #include <stdint.h> -#ifdef __HAVE_LONG_DOUBLE - #include "math.h" #include "math_private.h" +#ifdef __HAVE_LONG_DOUBLE + #define BIAS (LDBL_MAX_EXP - 1) #if EXT_FRACLBITS > 32