Module Name: src Committed By: martin Date: Mon Oct 14 15:41:30 UTC 2024
Modified Files: src/lib/libm/src [netbsd-10]: s_nextafter.c s_nexttowardf.c Log Message: Additionally pull up following revision(s) (requested by riastradh in ticket #963): lib/libm/src/s_nextafter.c: revision 1.17 lib/libm/src/s_nexttowardf.c: revision 1.4 libm: Make s_nexttowardf.c work when long double is double. Seems likely that there are other parts of libm which would benefit from being defined unconditionally in terms of ieee_ext_u, with ieee_ext_u as an alias for ieee_double_u, in this scenario. But I haven't gone looking yet. libm: If long double is double, nexttowardl is nextafter. long double nexttowardl(long double, long double); double nextafter(double, double); To generate a diff of this commit: cvs rdiff -u -r1.16 -r1.16.14.1 src/lib/libm/src/s_nextafter.c cvs rdiff -u -r1.3 -r1.3.44.1 src/lib/libm/src/s_nexttowardf.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_nextafter.c diff -u src/lib/libm/src/s_nextafter.c:1.16 src/lib/libm/src/s_nextafter.c:1.16.14.1 --- src/lib/libm/src/s_nextafter.c:1.16 Wed Aug 16 11:22:52 2017 +++ src/lib/libm/src/s_nextafter.c Mon Oct 14 15:41:30 2024 @@ -12,7 +12,7 @@ #include <sys/cdefs.h> #if defined(LIBM_SCCS) && !defined(lint) -__RCSID("$NetBSD: s_nextafter.c,v 1.16 2017/08/16 11:22:52 he Exp $"); +__RCSID("$NetBSD: s_nextafter.c,v 1.16.14.1 2024/10/14 15:41:30 martin Exp $"); #endif /* IEEE functions @@ -28,6 +28,7 @@ __RCSID("$NetBSD: s_nextafter.c,v 1.16 2 #ifndef __HAVE_LONG_DOUBLE __strong_alias(nextafterl, nextafter) __strong_alias(nexttoward, nextafter) +__strong_alias(nexttowardl, nextafter) #endif double Index: src/lib/libm/src/s_nexttowardf.c diff -u src/lib/libm/src/s_nexttowardf.c:1.3 src/lib/libm/src/s_nexttowardf.c:1.3.44.1 --- src/lib/libm/src/s_nexttowardf.c:1.3 Sat Feb 9 23:14:44 2013 +++ src/lib/libm/src/s_nexttowardf.c Mon Oct 14 15:41:30 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: s_nexttowardf.c,v 1.3 2013/02/09 23:14:44 christos Exp $ */ +/* $NetBSD: s_nexttowardf.c,v 1.3.44.1 2024/10/14 15:41:30 martin Exp $ */ /* * ==================================================== @@ -15,7 +15,7 @@ #if 0 __FBSDID("$FreeBSD: src/lib/msun/src/s_nexttowardf.c,v 1.3 2011/02/10 07:38:38 das Exp $"); #else -__RCSID("$NetBSD: s_nexttowardf.c,v 1.3 2013/02/09 23:14:44 christos Exp $"); +__RCSID("$NetBSD: s_nexttowardf.c,v 1.3.44.1 2024/10/14 15:41:30 martin Exp $"); #endif #include <string.h> @@ -25,7 +25,23 @@ __RCSID("$NetBSD: s_nexttowardf.c,v 1.3 #include "math.h" #include "math_private.h" -#ifdef EXT_EXP_INFNAN +/* + * On ports where long double is just double, reuse the ieee_double_u + * union as if it were ieee_ext_u -- broken-down components of (long) + * double values. + */ +#ifndef __HAVE_LONG_DOUBLE +#define ieee_ext_u ieee_double_u +#define extu_ld dblu_d +#define extu_ext dblu_dbl +#define ext_sign dbl_sign +#define ext_exp dbl_exp +#define ext_frach dbl_frach +#define ext_fracl dbl_fracl +#define EXT_EXP_INFNAN DBL_EXP_INFNAN +#define LDBL_NBIT 0 +#endif + float nexttowardf(float x, long double y) { @@ -38,7 +54,7 @@ nexttowardf(float x, long double y) memset(&uy, 0, sizeof(uy)); uy.extu_ld = y; - uy.extu_ext.ext_frach &= ~0x80000000; + uy.extu_ext.ext_frach &= ~LDBL_NBIT; if((ix>0x7f800000) || (uy.extu_ext.ext_exp == EXT_EXP_INFNAN && @@ -66,4 +82,3 @@ nexttowardf(float x, long double y) SET_FLOAT_WORD(x,hx); return x; } -#endif