CVS commit: src/lib/libm/src

2024-05-07 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Wed May  8 01:58:52 UTC 2024

Removed Files:
src/lib/libm/src: ldbl_dummy.c

Log Message:
libm: ldbl_dummy.c is no longer needed -- nix it.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r0 src/lib/libm/src/ldbl_dummy.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/lib/libm/src

2024-05-07 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Wed May  8 01:58:52 UTC 2024

Removed Files:
src/lib/libm/src: ldbl_dummy.c

Log Message:
libm: ldbl_dummy.c is no longer needed -- nix it.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r0 src/lib/libm/src/ldbl_dummy.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/lib/libm/src

2024-05-05 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun May  5 22:10:06 UTC 2024

Modified Files:
src/lib/libm/src: s_nextafter.c

Log Message:
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.17 src/lib/libm/src/s_nextafter.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.17
--- src/lib/libm/src/s_nextafter.c:1.16	Wed Aug 16 11:22:52 2017
+++ src/lib/libm/src/s_nextafter.c	Sun May  5 22:10:06 2024
@@ -12,7 +12,7 @@
 
 #include 
 #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.17 2024/05/05 22:10:06 riastradh 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



CVS commit: src/lib/libm/src

2024-05-05 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun May  5 22:10:06 UTC 2024

Modified Files:
src/lib/libm/src: s_nextafter.c

Log Message:
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.17 src/lib/libm/src/s_nextafter.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/lib/libm/src

2024-05-05 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun May  5 14:06:47 UTC 2024

Modified Files:
src/lib/libm/src: s_nexttowardf.c

Log Message:
libm/s_nexttowardf.c: Handle __HAVE_LONG_DOUBLE, LDBL_IMPLICIT_NBIT.

We should arrange to just have LDBL_NBIT unconditionally defined in the
appropriate MD header file, and make LDBL_IMPLICIT_NBIT an alias for
LDBL_NBIT==0.  But for now this will do.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 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_nexttowardf.c
diff -u src/lib/libm/src/s_nexttowardf.c:1.4 src/lib/libm/src/s_nexttowardf.c:1.5
--- src/lib/libm/src/s_nexttowardf.c:1.4	Sun May  5 11:38:03 2024
+++ src/lib/libm/src/s_nexttowardf.c	Sun May  5 14:06:47 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: s_nexttowardf.c,v 1.4 2024/05/05 11:38:03 riastradh Exp $	*/
+/*	$NetBSD: s_nexttowardf.c,v 1.5 2024/05/05 14:06:47 riastradh 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.4 2024/05/05 11:38:03 riastradh Exp $");
+__RCSID("$NetBSD: s_nexttowardf.c,v 1.5 2024/05/05 14:06:47 riastradh Exp $");
 #endif
 
 #include 
@@ -42,6 +42,14 @@ __RCSID("$NetBSD: s_nexttowardf.c,v 1.4 
 #define	LDBL_NBIT	0
 #endif
 
+/*
+ * XXX We should arrange to define LDBL_NBIT unconditionally in the
+ * appropriate MD header file.
+ */
+#ifdef LDBL_IMPLICIT_NBIT
+#define	LDBL_NBIT	0
+#endif
+
 float
 nexttowardf(float x, long double y)
 {



CVS commit: src/lib/libm/src

2024-05-05 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun May  5 14:06:47 UTC 2024

Modified Files:
src/lib/libm/src: s_nexttowardf.c

Log Message:
libm/s_nexttowardf.c: Handle __HAVE_LONG_DOUBLE, LDBL_IMPLICIT_NBIT.

We should arrange to just have LDBL_NBIT unconditionally defined in the
appropriate MD header file, and make LDBL_IMPLICIT_NBIT an alias for
LDBL_NBIT==0.  But for now this will do.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 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.



CVS commit: src/lib/libm/src

2024-05-05 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun May  5 11:38:03 UTC 2024

Modified Files:
src/lib/libm/src: s_nexttowardf.c

Log Message:
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.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 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.



CVS commit: src/lib/libm/src

2024-05-05 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun May  5 11:38:03 UTC 2024

Modified Files:
src/lib/libm/src: s_nexttowardf.c

Log Message:
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.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 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_nexttowardf.c
diff -u src/lib/libm/src/s_nexttowardf.c:1.3 src/lib/libm/src/s_nexttowardf.c:1.4
--- src/lib/libm/src/s_nexttowardf.c:1.3	Sat Feb  9 23:14:44 2013
+++ src/lib/libm/src/s_nexttowardf.c	Sun May  5 11:38:03 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.4 2024/05/05 11:38:03 riastradh 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.4 2024/05/05 11:38:03 riastradh Exp $");
 #endif
 
 #include 
@@ -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(, 0, sizeof(uy));
 	uy.extu_ld = y;
-	uy.extu_ext.ext_frach &= ~0x8000;
+	uy.extu_ext.ext_frach &= ~LDBL_NBIT;
 
 	if((ix>0x7f80) ||
 	   (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



CVS commit: src/lib/libm/src

2024-05-04 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sat May  4 19:21:51 UTC 2024

Modified Files:
src/lib/libm/src: s_rintl.c

Log Message:
s_rintl.c: Reduce FreeBSD diff and fix on ld128 platforms.

EXT_FRACBITS, the number of bits in the _binary encoding_ that stores
the trailing significand field, is never 113.  In IEEE 754 binary128,
it is 112, even though there are 113 bits of precision in the set of
floating-point numbers -- the leading 1 bit is implicit in binary128.
So ld128 platforms like aarch64 and sparc64 were skipping the real
definition and just defining rintl as an alias for rint, which is
wrong.

In contrast, LDBL_MANT_DIG, the number of bits of precision in the set
of floating-point numbers (p, in IEEE 754 parlance), is 113 in IEEE 754
binary128.  This is also the constant used in FreeBSD libm anyway.  So
let's just use that instead of trying to translate it to our private
EXT_FRACBITS (not defined in FreeBSD) with a fencepos terror.  And
delete the buggy rintl=rint alias.

PR lib/58054


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/lib/libm/src/s_rintl.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_rintl.c
diff -u src/lib/libm/src/s_rintl.c:1.6 src/lib/libm/src/s_rintl.c:1.7
--- src/lib/libm/src/s_rintl.c:1.6	Tue Apr  2 18:39:51 2024
+++ src/lib/libm/src/s_rintl.c	Sat May  4 19:21:51 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: s_rintl.c,v 1.6 2024/04/02 18:39:51 christos Exp $	*/
+/*	$NetBSD: s_rintl.c,v 1.7 2024/05/04 19:21:51 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2008 David Schultz 
@@ -30,7 +30,7 @@
 #if 0
 __FBSDID("$FreeBSD: src/lib/msun/src/s_rintl.c,v 1.5 2008/02/22 11:59:05 bde Exp $");
 #else
-__RCSID("$NetBSD: s_rintl.c,v 1.6 2024/04/02 18:39:51 christos Exp $");
+__RCSID("$NetBSD: s_rintl.c,v 1.7 2024/05/04 19:21:51 riastradh Exp $");
 #endif
 
 #include 
@@ -39,20 +39,17 @@ __RCSID("$NetBSD: s_rintl.c,v 1.6 2024/0
 #include "math.h"
 #include "math_private.h"
 
-#ifdef __HAVE_LONG_DOUBLE
+#define	BIAS	(LDBL_MAX_EXP - 1)
 
-# if EXT_FRACBITS == 64 || EXT_FRACBITS == 113 && LDBL_MAX_EXP == 0x4000
-
-#  define BIAS (LDBL_MAX_EXP - 1)
 static const float
 shift[2] = {
-#  if EXT_FRACBITS == 64
+#if LDBL_MANT_DIG == 64
 	0x1.0p63, -0x1.0p63
-#  elif EXT_FRACBITS == 113
+#elif LDBL_MANT_DIG == 113
 	0x1.0p112, -0x1.0p112
-#  else
-#   error "Unsupported long double format"
-#  endif
+#else
+#error "Unsupported long double format"
+#endif
 };
 static const float zero[2] = { 0.0, -0.0 };
 
@@ -64,12 +61,11 @@ rintl(long double x)
 	int ex, sign;
 
 	u.extu_ld = x;
-	u.extu_ext.ext_frach &= ~0x8000;
 	expsign = GET_EXPSIGN();
 	ex = expsign & 0x7fff;
 
-	if (ex >= BIAS + EXT_FRACBITS - 1) {
-		if (ex == BIAS + EXT_FRACBITS)
+	if (ex >= BIAS + LDBL_MANT_DIG - 1) {
+		if (ex == BIAS + LDBL_MAX_EXP)
 			return (x + x);	/* Inf, NaN, or unsupported format */
 		return (x);		/* finite and already an integer */
 	}
@@ -94,13 +90,3 @@ rintl(long double x)
 
 	return (x);
 }
-# else
-
-long double
-rintl(long double x)
-{
-	return rint(x);
-}
-
-# endif
-#endif /* __HAVE_LONG_DOUBLE */



CVS commit: src/lib/libm/src

2024-05-04 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sat May  4 19:21:51 UTC 2024

Modified Files:
src/lib/libm/src: s_rintl.c

Log Message:
s_rintl.c: Reduce FreeBSD diff and fix on ld128 platforms.

EXT_FRACBITS, the number of bits in the _binary encoding_ that stores
the trailing significand field, is never 113.  In IEEE 754 binary128,
it is 112, even though there are 113 bits of precision in the set of
floating-point numbers -- the leading 1 bit is implicit in binary128.
So ld128 platforms like aarch64 and sparc64 were skipping the real
definition and just defining rintl as an alias for rint, which is
wrong.

In contrast, LDBL_MANT_DIG, the number of bits of precision in the set
of floating-point numbers (p, in IEEE 754 parlance), is 113 in IEEE 754
binary128.  This is also the constant used in FreeBSD libm anyway.  So
let's just use that instead of trying to translate it to our private
EXT_FRACBITS (not defined in FreeBSD) with a fencepos terror.  And
delete the buggy rintl=rint alias.

PR lib/58054


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/lib/libm/src/s_rintl.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/lib/libm/src

2024-04-03 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Apr  3 14:54:51 UTC 2024

Modified Files:
src/lib/libm/src: s_cbrtl.c

Log Message:
need  for i386.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/lib/libm/src/s_cbrtl.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_cbrtl.c
diff -u src/lib/libm/src/s_cbrtl.c:1.2 src/lib/libm/src/s_cbrtl.c:1.3
--- src/lib/libm/src/s_cbrtl.c:1.2	Tue Apr  2 21:51:01 2024
+++ src/lib/libm/src/s_cbrtl.c	Wed Apr  3 10:54:50 2024
@@ -14,10 +14,11 @@
  * and David A. Schultz.
  */
 #include 
-__RCSID("$NetBSD: s_cbrtl.c,v 1.2 2024/04/03 01:51:01 christos Exp $");
+__RCSID("$NetBSD: s_cbrtl.c,v 1.3 2024/04/03 14:54:50 christos Exp $");
 
 
 #include "namespace.h"
+#include 
 #include 
 #include 
 



CVS commit: src/lib/libm/src

2024-04-03 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Apr  3 14:54:51 UTC 2024

Modified Files:
src/lib/libm/src: s_cbrtl.c

Log Message:
need  for i386.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/lib/libm/src/s_cbrtl.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/lib/libm/src

2024-04-02 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Wed Apr  3 04:40:23 UTC 2024

Modified Files:
src/lib/libm/src: math_private.h

Log Message:
For i386, if ft[sg]etprec() are to be used, ensure there's a
prototype for them in scope (so include )

Might fix the i386 build.


To generate a diff of this commit:
cvs rdiff -u -r1.31 -r1.32 src/lib/libm/src/math_private.h

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/math_private.h
diff -u src/lib/libm/src/math_private.h:1.31 src/lib/libm/src/math_private.h:1.32
--- src/lib/libm/src/math_private.h:1.31	Tue Jan 23 15:45:07 2024
+++ src/lib/libm/src/math_private.h	Wed Apr  3 04:40:23 2024
@@ -11,7 +11,7 @@
 
 /*
  * from: @(#)fdlibm.h 5.1 93/09/24
- * $NetBSD: math_private.h,v 1.31 2024/01/23 15:45:07 christos Exp $
+ * $NetBSD: math_private.h,v 1.32 2024/04/03 04:40:23 kre Exp $
  */
 
 #ifndef _MATH_PRIVATE_H_
@@ -348,6 +348,9 @@ do {\
 
 /* Support switching the mode to FP_PE if necessary. */
 #if defined(__i386__) && !defined(NO_FPSETPREC)
+
+#include 
+
 #define	ENTERI() ENTERIT(long double)
 #define	ENTERIT(returntype)			\
 	returntype __retval;			\



CVS commit: src/lib/libm/src

2024-04-02 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Wed Apr  3 04:40:23 UTC 2024

Modified Files:
src/lib/libm/src: math_private.h

Log Message:
For i386, if ft[sg]etprec() are to be used, ensure there's a
prototype for them in scope (so include )

Might fix the i386 build.


To generate a diff of this commit:
cvs rdiff -u -r1.31 -r1.32 src/lib/libm/src/math_private.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/lib/libm/src

2024-04-02 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Apr  3 01:51:02 UTC 2024

Modified Files:
src/lib/libm/src: s_cbrtl.c

Log Message:
reduce diff with FreeBSD


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/lib/libm/src/s_cbrtl.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_cbrtl.c
diff -u src/lib/libm/src/s_cbrtl.c:1.1 src/lib/libm/src/s_cbrtl.c:1.2
--- src/lib/libm/src/s_cbrtl.c:1.1	Tue Nov 19 14:24:34 2013
+++ src/lib/libm/src/s_cbrtl.c	Tue Apr  2 21:51:01 2024
@@ -13,12 +13,9 @@
  * written by Steven G. Kargl with input from Bruce D. Evans
  * and David A. Schultz.
  */
-
 #include 
-__RCSID("$NetBSD: s_cbrtl.c,v 1.1 2013/11/19 19:24:34 joerg Exp $");
-#if 0
-__FBSDID("$FreeBSD: head/lib/msun/src/s_cbrtl.c 238924 2012-07-30 21:58:28Z kargl $");
-#endif
+__RCSID("$NetBSD: s_cbrtl.c,v 1.2 2024/04/03 01:51:01 christos Exp $");
+
 
 #include "namespace.h"
 #include 
@@ -30,44 +27,48 @@ __FBSDID("$FreeBSD: head/lib/msun/src/s_
 #ifdef __HAVE_LONG_DOUBLE
 __weak_alias(cbrtl, _cbrtl)
 
+#define	BIAS	(LDBL_MAX_EXP - 1)
+
 static const unsigned
 B1 = 709958130;	/* B1 = (127-127.0/3-0.03306235651)*2**23 */
 
 long double
 cbrtl(long double x)
 {
-	union ieee_ext_u ux, vx;
+	union ieee_ext_u u, v;
 	long double r, s, t, w;
 	double dr, dt, dx;
 	float ft, fx;
 	uint32_t hx;
+	uint16_t expsign;
 	int k;
 
-	ux.extu_ld = x;
-
+	u.extu_ld = x;
+	expsign = GET_EXPSIGN();
+	k = expsign & 0x7fff;
 
 	/*
 	 * If x = +-Inf, then cbrt(x) = +-Inf.
 	 * If x = NaN, then cbrt(x) = NaN.
 	 */
-	if (ux.extu_exp == EXT_EXP_INFNAN)
+	if (k == BIAS + LDBL_MAX_EXP)
 		return (x + x);
-	if ((ux.extu_frach | ux.extu_fracl | ux.extu_exp) == 0)
-		return (x);
 
-	vx.extu_ld = 1;
-	vx.extu_ext.ext_sign = ux.extu_ext.ext_sign;
-	ux.extu_ext.ext_sign = 0;
-	if (ux.extu_exp == 0) {
+	ENTERI();
+	if (k == 0) {
+		/* If x = +-0, then cbrt(x) = +-0. */
+		if ((u.extu_frach | u.extu_fracl) == 0)
+			RETURNI(x);
 		/* Adjust subnormal numbers. */
-		ux.extu_ld *= 0x1.0p514;
-		k = ux.extu_exp - EXT_EXP_BIAS - 514;
-	} else {
-		k = ux.extu_exp - EXT_EXP_BIAS;
-	}
+		u.extu_ld *= 0x1.0p514;
+		k = u.extu_exp;
+		k -= BIAS + 514;
+ 	} else
+		k -= BIAS;
+	SET_EXPSIGN(, BIAS);
+	v.extu_ld = 1; 
 
-	ux.extu_exp = EXT_EXP_BIAS;
-	x = ux.extu_ld;
+	x = u.extu_ld;
 	switch (k % 3) {
 	case 1:
 	case -2:
@@ -80,7 +81,7 @@ cbrtl(long double x)
 		k -= 2;
 		break;
 	}
-	vx.extu_exp = EXT_EXP_BIAS + k / 3;
+	SET_EXPSIGN(, (expsign & 0x8000) | (BIAS + k / 3));
 
 	/*
 	 * The following is the guts of s_cbrtf, with the handling of
@@ -136,10 +137,9 @@ cbrtl(long double x)
 	r=x/s;/* error <= 0.5 ulps; |r| < |t| */
 	w=t+t;/* t+t is exact */
 	r=(r-t)/(w+r);			/* r-t is exact; w+r ~= 3*t */
-	t=t+t*r;			/* error <= 0.5 + 0.5/3 + epsilon */
+	t=t+t*r;			/* error <= (0.5 + 0.5/3) * ulp */
 
-	t *= vx.extu_ld;
-	return t;
+	t *= v.extu_ld;
+	RETURNI(t);
 }
-
 #endif /* __HAVE_LONG_DOUBLE */



CVS commit: src/lib/libm/src

2024-04-02 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Apr  3 01:51:02 UTC 2024

Modified Files:
src/lib/libm/src: s_cbrtl.c

Log Message:
reduce diff with FreeBSD


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/lib/libm/src/s_cbrtl.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/lib/libm/src

2024-04-02 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Apr  2 18:40:50 UTC 2024

Modified Files:
src/lib/libm/src: s_fabsl.c

Log Message:
undo accidental commit.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/lib/libm/src/s_fabsl.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_fabsl.c
diff -u src/lib/libm/src/s_fabsl.c:1.7 src/lib/libm/src/s_fabsl.c:1.8
--- src/lib/libm/src/s_fabsl.c:1.7	Tue Apr  2 14:39:51 2024
+++ src/lib/libm/src/s_fabsl.c	Tue Apr  2 14:40:50 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: s_fabsl.c,v 1.7 2024/04/02 18:39:51 christos Exp $	*/
+/*	$NetBSD: s_fabsl.c,v 1.8 2024/04/02 18:40:50 christos Exp $	*/
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -26,7 +26,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include 
-__RCSID("$NetBSD: s_fabsl.c,v 1.7 2024/04/02 18:39:51 christos Exp $");
+__RCSID("$NetBSD: s_fabsl.c,v 1.8 2024/04/02 18:40:50 christos Exp $");
 
 #include 
 #include 
@@ -47,6 +47,7 @@ fabsl(long double x)
 	return (ux.extu_ld);
 }
 #else
+#if 0
 /* defined in libc */
 long double
 fabsl(long double x)
@@ -54,3 +55,4 @@ fabsl(long double x)
 	return fabs(x);
 }
 #endif
+#endif



CVS commit: src/lib/libm/src

2024-04-02 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Apr  2 18:40:50 UTC 2024

Modified Files:
src/lib/libm/src: s_fabsl.c

Log Message:
undo accidental commit.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/lib/libm/src/s_fabsl.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/lib/libm/src

2024-04-02 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Apr  2 18:39:51 UTC 2024

Modified Files:
src/lib/libm/src: s_fabsl.c s_rintl.c

Log Message:
PR/58054: Martin Husemann: fix bug in expsign extraction and only use the
code for the floating point formats where it works (does not work for 112
bit mantisa in sparc64)


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/lib/libm/src/s_fabsl.c
cvs rdiff -u -r1.5 -r1.6 src/lib/libm/src/s_rintl.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/lib/libm/src

2024-04-02 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Apr  2 18:39:51 UTC 2024

Modified Files:
src/lib/libm/src: s_fabsl.c s_rintl.c

Log Message:
PR/58054: Martin Husemann: fix bug in expsign extraction and only use the
code for the floating point formats where it works (does not work for 112
bit mantisa in sparc64)


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/lib/libm/src/s_fabsl.c
cvs rdiff -u -r1.5 -r1.6 src/lib/libm/src/s_rintl.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_fabsl.c
diff -u src/lib/libm/src/s_fabsl.c:1.6 src/lib/libm/src/s_fabsl.c:1.7
--- src/lib/libm/src/s_fabsl.c:1.6	Sun Feb 25 14:26:33 2024
+++ src/lib/libm/src/s_fabsl.c	Tue Apr  2 14:39:51 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: s_fabsl.c,v 1.6 2024/02/25 19:26:33 christos Exp $	*/
+/*	$NetBSD: s_fabsl.c,v 1.7 2024/04/02 18:39:51 christos Exp $	*/
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -26,7 +26,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include 
-__RCSID("$NetBSD: s_fabsl.c,v 1.6 2024/02/25 19:26:33 christos Exp $");
+__RCSID("$NetBSD: s_fabsl.c,v 1.7 2024/04/02 18:39:51 christos Exp $");
 
 #include 
 #include 
@@ -47,7 +47,6 @@ fabsl(long double x)
 	return (ux.extu_ld);
 }
 #else
-#if 0
 /* defined in libc */
 long double
 fabsl(long double x)
@@ -55,4 +54,3 @@ fabsl(long double x)
 	return fabs(x);
 }
 #endif
-#endif

Index: src/lib/libm/src/s_rintl.c
diff -u src/lib/libm/src/s_rintl.c:1.5 src/lib/libm/src/s_rintl.c:1.6
--- src/lib/libm/src/s_rintl.c:1.5	Wed Aug 21 09:04:44 2013
+++ src/lib/libm/src/s_rintl.c	Tue Apr  2 14:39:51 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: s_rintl.c,v 1.5 2013/08/21 13:04:44 martin Exp $	*/
+/*	$NetBSD: s_rintl.c,v 1.6 2024/04/02 18:39:51 christos Exp $	*/
 
 /*-
  * Copyright (c) 2008 David Schultz 
@@ -30,7 +30,7 @@
 #if 0
 __FBSDID("$FreeBSD: src/lib/msun/src/s_rintl.c,v 1.5 2008/02/22 11:59:05 bde Exp $");
 #else
-__RCSID("$NetBSD: s_rintl.c,v 1.5 2013/08/21 13:04:44 martin Exp $");
+__RCSID("$NetBSD: s_rintl.c,v 1.6 2024/04/02 18:39:51 christos Exp $");
 #endif
 
 #include 
@@ -40,17 +40,19 @@ __RCSID("$NetBSD: s_rintl.c,v 1.5 2013/0
 #include "math_private.h"
 
 #ifdef __HAVE_LONG_DOUBLE
+
+# if EXT_FRACBITS == 64 || EXT_FRACBITS == 113 && LDBL_MAX_EXP == 0x4000
+
+#  define BIAS (LDBL_MAX_EXP - 1)
 static const float
 shift[2] = {
-#if EXT_FRACBITS == 64
+#  if EXT_FRACBITS == 64
 	0x1.0p63, -0x1.0p63
-#elif EXT_FRACBITS == 113
+#  elif EXT_FRACBITS == 113
 	0x1.0p112, -0x1.0p112
-#elif EXT_FRACBITS == 112
-	0x1.0p111, -0x1.0p111
-#else
-#error "Unsupported long double format"
-#endif
+#  else
+#   error "Unsupported long double format"
+#  endif
 };
 static const float zero[2] = { 0.0, -0.0 };
 
@@ -63,11 +65,11 @@ rintl(long double x)
 
 	u.extu_ld = x;
 	u.extu_ext.ext_frach &= ~0x8000;
-	expsign = u.extu_ext.ext_sign;
+	expsign = GET_EXPSIGN();
 	ex = expsign & 0x7fff;
 
-	if (ex >= EXT_EXP_BIAS + EXT_FRACBITS - 1) {
-		if (ex == EXT_EXP_BIAS + EXT_FRACBITS)
+	if (ex >= BIAS + EXT_FRACBITS - 1) {
+		if (ex == BIAS + EXT_FRACBITS)
 			return (x + x);	/* Inf, NaN, or unsupported format */
 		return (x);		/* finite and already an integer */
 	}
@@ -87,9 +89,18 @@ rintl(long double x)
 	 * If the result is +-0, then it must have the same sign as x, but
 	 * the above calculation doesn't always give this.  Fix up the sign.
 	 */
-	if (ex < EXT_EXP_BIAS && x == 0.0L)
+	if (ex < BIAS && x == 0.0L)
 		return (zero[sign]);
 
 	return (x);
 }
-#endif
+# else
+
+long double
+rintl(long double x)
+{
+	return rint(x);
+}
+
+# endif
+#endif /* __HAVE_LONG_DOUBLE */



CVS commit: src/lib/libm/src

2024-02-25 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Feb 25 19:26:34 UTC 2024

Modified Files:
src/lib/libm/src: s_fabsl.c

Log Message:
fabsl is defined in libc...


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/lib/libm/src/s_fabsl.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_fabsl.c
diff -u src/lib/libm/src/s_fabsl.c:1.5 src/lib/libm/src/s_fabsl.c:1.6
--- src/lib/libm/src/s_fabsl.c:1.5	Sat Feb 24 10:16:53 2024
+++ src/lib/libm/src/s_fabsl.c	Sun Feb 25 14:26:33 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: s_fabsl.c,v 1.5 2024/02/24 15:16:53 christos Exp $	*/
+/*	$NetBSD: s_fabsl.c,v 1.6 2024/02/25 19:26:33 christos Exp $	*/
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -26,7 +26,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include 
-__RCSID("$NetBSD: s_fabsl.c,v 1.5 2024/02/24 15:16:53 christos Exp $");
+__RCSID("$NetBSD: s_fabsl.c,v 1.6 2024/02/25 19:26:33 christos Exp $");
 
 #include 
 #include 
@@ -47,9 +47,12 @@ fabsl(long double x)
 	return (ux.extu_ld);
 }
 #else
+#if 0
+/* defined in libc */
 long double
 fabsl(long double x)
 {
 	return fabs(x);
 }
 #endif
+#endif



CVS commit: src/lib/libm/src

2024-02-25 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Feb 25 19:26:34 UTC 2024

Modified Files:
src/lib/libm/src: s_fabsl.c

Log Message:
fabsl is defined in libc...


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/lib/libm/src/s_fabsl.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/lib/libm/src

2024-02-24 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Sat Feb 24 19:32:09 UTC 2024

Modified Files:
src/lib/libm/src: namespace.h s_atanl.c s_remquo.c s_remquof.c
s_remquol.c

Log Message:
fix some fallout from 32-bit fixes for long double functions.

apply namespace.h to remqou*.  add missing weak aliases for some of them,
and normalise checkf for __weak_alias().

now libm.so seems to only have libc undefined symbols.


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/lib/libm/src/namespace.h
cvs rdiff -u -r1.4 -r1.5 src/lib/libm/src/s_atanl.c \
src/lib/libm/src/s_remquol.c
cvs rdiff -u -r1.1 -r1.2 src/lib/libm/src/s_remquo.c \
src/lib/libm/src/s_remquof.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/namespace.h
diff -u src/lib/libm/src/namespace.h:1.18 src/lib/libm/src/namespace.h:1.19
--- src/lib/libm/src/namespace.h:1.18	Sun Jan 21 18:53:18 2024
+++ src/lib/libm/src/namespace.h	Sat Feb 24 19:32:09 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: namespace.h,v 1.18 2024/01/21 18:53:18 christos Exp $ */
+/* $NetBSD: namespace.h,v 1.19 2024/02/24 19:32:09 mrg Exp $ */
 
 #define atan2 _atan2
 #define atan2f _atan2f
@@ -37,6 +37,10 @@
 #define asinf _asinf
 #define asinl _asinl
 
+#define remquo _remquo
+#define remquof _remquof
+#define remquol _remquol
+
 #define casin _casin
 #define casinf _casinf
 #define casinl _casinl

Index: src/lib/libm/src/s_atanl.c
diff -u src/lib/libm/src/s_atanl.c:1.4 src/lib/libm/src/s_atanl.c:1.5
--- src/lib/libm/src/s_atanl.c:1.4	Sat Feb 24 15:16:53 2024
+++ src/lib/libm/src/s_atanl.c	Sat Feb 24 19:32:09 2024
@@ -19,7 +19,9 @@
 #include "math.h"
 #include "math_private.h"
 
+#ifdef __weak_alias
 __weak_alias(atanl, _atanl)
+#endif
 
 #ifdef __HAVE_LONG_DOUBLE
 
Index: src/lib/libm/src/s_remquol.c
diff -u src/lib/libm/src/s_remquol.c:1.4 src/lib/libm/src/s_remquol.c:1.5
--- src/lib/libm/src/s_remquol.c:1.4	Sat Feb 24 15:16:53 2024
+++ src/lib/libm/src/s_remquol.c	Sat Feb 24 19:32:09 2024
@@ -10,6 +10,9 @@
  */
 
 #include 
+
+#include "namespace.h"
+
 #include 
 #include 
 #include 

Index: src/lib/libm/src/s_remquo.c
diff -u src/lib/libm/src/s_remquo.c:1.1 src/lib/libm/src/s_remquo.c:1.2
--- src/lib/libm/src/s_remquo.c:1.1	Sun Feb  6 01:53:38 2011
+++ src/lib/libm/src/s_remquo.c	Sat Feb 24 19:32:09 2024
@@ -12,11 +12,17 @@
 
 #include 
 
+#include "namespace.h"
+
 #include 
 
 #include "math.h"
 #include "math_private.h"
 
+#ifdef __weak_alias
+__weak_alias(remquo, _remquo)
+#endif
+
 static const double Zero[] = {0.0, -0.0,};
 
 /*
Index: src/lib/libm/src/s_remquof.c
diff -u src/lib/libm/src/s_remquof.c:1.1 src/lib/libm/src/s_remquof.c:1.2
--- src/lib/libm/src/s_remquof.c:1.1	Sun Feb  6 01:53:38 2011
+++ src/lib/libm/src/s_remquof.c	Sat Feb 24 19:32:09 2024
@@ -12,9 +12,15 @@
 
 #include 
 
+#include "namespace.h"
+
 #include "math.h"
 #include "math_private.h"
 
+#ifdef __weak_alias
+__weak_alias(remquof, _remquof)
+#endif
+
 static const float Zero[] = {0.0, -0.0,};
 
 /*



CVS commit: src/lib/libm/src

2024-02-24 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Sat Feb 24 19:32:09 UTC 2024

Modified Files:
src/lib/libm/src: namespace.h s_atanl.c s_remquo.c s_remquof.c
s_remquol.c

Log Message:
fix some fallout from 32-bit fixes for long double functions.

apply namespace.h to remqou*.  add missing weak aliases for some of them,
and normalise checkf for __weak_alias().

now libm.so seems to only have libc undefined symbols.


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/lib/libm/src/namespace.h
cvs rdiff -u -r1.4 -r1.5 src/lib/libm/src/s_atanl.c \
src/lib/libm/src/s_remquol.c
cvs rdiff -u -r1.1 -r1.2 src/lib/libm/src/s_remquo.c \
src/lib/libm/src/s_remquof.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/lib/libm/src

2024-02-24 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Feb 24 15:16:53 UTC 2024

Modified Files:
src/lib/libm/src: b_tgammal.c e_acoshl.c e_acosl.c e_asinl.c e_atanhl.c
s_asinhl.c s_atanl.c s_cospil.c s_erfl.c s_exp2l.c s_fabsl.c
s_llrintl.c s_logl.c s_lrintl.c s_nearbyint.c s_remquol.c
s_sincosl.c s_sinpil.c s_tanhl.c s_tanpil.c

Log Message:
add missing symbols for non long double architectures.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/lib/libm/src/b_tgammal.c \
src/lib/libm/src/e_acoshl.c src/lib/libm/src/e_acosl.c \
src/lib/libm/src/e_asinl.c src/lib/libm/src/e_atanhl.c \
src/lib/libm/src/s_asinhl.c src/lib/libm/src/s_cospil.c \
src/lib/libm/src/s_erfl.c src/lib/libm/src/s_exp2l.c \
src/lib/libm/src/s_sincosl.c src/lib/libm/src/s_sinpil.c \
src/lib/libm/src/s_tanhl.c src/lib/libm/src/s_tanpil.c
cvs rdiff -u -r1.3 -r1.4 src/lib/libm/src/s_atanl.c \
src/lib/libm/src/s_llrintl.c src/lib/libm/src/s_logl.c \
src/lib/libm/src/s_lrintl.c src/lib/libm/src/s_remquol.c
cvs rdiff -u -r1.4 -r1.5 src/lib/libm/src/s_fabsl.c \
src/lib/libm/src/s_nearbyint.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/b_tgammal.c
diff -u src/lib/libm/src/b_tgammal.c:1.2 src/lib/libm/src/b_tgammal.c:1.3
--- src/lib/libm/src/b_tgammal.c:1.2	Tue Jan 23 10:45:07 2024
+++ src/lib/libm/src/b_tgammal.c	Sat Feb 24 10:16:53 2024
@@ -1,4 +1,4 @@
-/* 	$NetBSD: b_tgammal.c,v 1.2 2024/01/23 15:45:07 christos Exp $	*/
+/* 	$NetBSD: b_tgammal.c,v 1.3 2024/02/24 15:16:53 christos Exp $	*/
 
 /*-
  * Copyright (c) 2023 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 #include 
 #if defined(LIBM_SCCS) && !defined(lint)
-__RCSID("$NetBSD: b_tgammal.c,v 1.2 2024/01/23 15:45:07 christos Exp $");
+__RCSID("$NetBSD: b_tgammal.c,v 1.3 2024/02/24 15:16:53 christos Exp $");
 #endif
 
 #include "namespace.h"
@@ -38,13 +38,12 @@ __RCSID("$NetBSD: b_tgammal.c,v 1.2 2024
 #include 
 #include 
 
-
-#ifdef __HAVE_LONG_DOUBLE
-
 #ifdef __weak_alias
 __weak_alias(tgammal,_tgammal)
 #endif
 
+#ifdef __HAVE_LONG_DOUBLE
+
 #if LDBL_MANT_DIG == 64
 #include "../ld80/b_tgammal.c"
 #elif LDBL_MANT_DIG == 113
@@ -55,8 +54,10 @@ __weak_alias(tgammal,_tgammal)
 
 #else
 
-#ifdef __weak_alias
-__weak_alias(tgammal, tgamma)
-#endif
+long double 
+tgammal(long double x)
+{  
+	return tgamma(x);
+}
 
 #endif
Index: src/lib/libm/src/e_acoshl.c
diff -u src/lib/libm/src/e_acoshl.c:1.2 src/lib/libm/src/e_acoshl.c:1.3
--- src/lib/libm/src/e_acoshl.c:1.2	Sat Jan 27 00:50:42 2024
+++ src/lib/libm/src/e_acoshl.c	Sat Feb 24 10:16:53 2024
@@ -22,9 +22,10 @@
 #include "math.h"
 #include "math_private.h"
 
-#ifdef __HAVE_LONG_DOUBLE
 __weak_alias(acoshl, _acoshl)
 
+#ifdef __HAVE_LONG_DOUBLE
+
 /*
  * See e_acosh.c for complete comments.
  *
@@ -92,6 +93,9 @@ acoshl(long double x)
 	}
 }
 #else
-
-__weak_alias(acoshl, acosh)
+long double
+acoshl(long double x)
+{
+	return acosh(x);
+}
 #endif
Index: src/lib/libm/src/e_acosl.c
diff -u src/lib/libm/src/e_acosl.c:1.2 src/lib/libm/src/e_acosl.c:1.3
--- src/lib/libm/src/e_acosl.c:1.2	Sat Jan 27 00:50:42 2024
+++ src/lib/libm/src/e_acosl.c	Sat Feb 24 10:16:53 2024
@@ -24,9 +24,10 @@
 #include "math.h"
 #include "math_private.h"
 
-#ifdef __HAVE_LONG_DOUBLE
 __weak_alias(acosl, _acosl)
 
+#ifdef __HAVE_LONG_DOUBLE
+
 #if LDBL_MANT_DIG == 64
 #include "../ld80/invtrig.h"
 #elif LDBL_MANT_DIG == 113
@@ -99,5 +100,9 @@ acosl(long double x)
 	}
 }
 #else
-__weak_alias(acosl, acos)
+long double
+acosl(long double x)
+{
+	return acos(x);
+}
 #endif
Index: src/lib/libm/src/e_asinl.c
diff -u src/lib/libm/src/e_asinl.c:1.2 src/lib/libm/src/e_asinl.c:1.3
--- src/lib/libm/src/e_asinl.c:1.2	Sat Jan 27 00:50:42 2024
+++ src/lib/libm/src/e_asinl.c	Sat Feb 24 10:16:53 2024
@@ -24,10 +24,10 @@
 #include "math.h"
 #include "math_private.h"
 
-#ifdef __HAVE_LONG_DOUBLE
-
 __weak_alias(asinl, _asinl)
 
+#ifdef __HAVE_LONG_DOUBLE
+
 #if LDBL_MANT_DIG == 64
 #include "../ld80/invtrig.h"
 #elif LDBL_MANT_DIG == 113
@@ -90,5 +90,9 @@ asinl(long double x)
 	if(expsign>0) return t; else return -t;
 }
 #else
-__weak_alias(asinl, _asin)
+long double
+asinl(long double x)
+{
+	return asin(x);
+}
 #endif
Index: src/lib/libm/src/e_atanhl.c
diff -u src/lib/libm/src/e_atanhl.c:1.2 src/lib/libm/src/e_atanhl.c:1.3
--- src/lib/libm/src/e_atanhl.c:1.2	Sat Jan 27 00:50:42 2024
+++ src/lib/libm/src/e_atanhl.c	Sat Feb 24 10:16:53 2024
@@ -22,8 +22,9 @@
 #include "math.h"
 #include "math_private.h"
 
-#ifdef __HAVE_LONG_DOUBLE
 __weak_alias(atanhl, _atanhl)
+
+#ifdef __HAVE_LONG_DOUBLE
 /*
  * See e_atanh.c for complete comments.
  *
@@ -76,5 +77,9 @@ atanhl(long double x)
 	RETURNI((hx & 0x8000) == 0 ? t : -t);
 }
 #else
-__weak_alias(atanhl, atanh)
+long double
+atanhl(long double x)
+{
+	return atanh(x);
+}
 #endif
Index: src/lib/libm/src/s_asinhl.c

CVS commit: src/lib/libm/src

2024-02-24 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Feb 24 15:16:53 UTC 2024

Modified Files:
src/lib/libm/src: b_tgammal.c e_acoshl.c e_acosl.c e_asinl.c e_atanhl.c
s_asinhl.c s_atanl.c s_cospil.c s_erfl.c s_exp2l.c s_fabsl.c
s_llrintl.c s_logl.c s_lrintl.c s_nearbyint.c s_remquol.c
s_sincosl.c s_sinpil.c s_tanhl.c s_tanpil.c

Log Message:
add missing symbols for non long double architectures.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/lib/libm/src/b_tgammal.c \
src/lib/libm/src/e_acoshl.c src/lib/libm/src/e_acosl.c \
src/lib/libm/src/e_asinl.c src/lib/libm/src/e_atanhl.c \
src/lib/libm/src/s_asinhl.c src/lib/libm/src/s_cospil.c \
src/lib/libm/src/s_erfl.c src/lib/libm/src/s_exp2l.c \
src/lib/libm/src/s_sincosl.c src/lib/libm/src/s_sinpil.c \
src/lib/libm/src/s_tanhl.c src/lib/libm/src/s_tanpil.c
cvs rdiff -u -r1.3 -r1.4 src/lib/libm/src/s_atanl.c \
src/lib/libm/src/s_llrintl.c src/lib/libm/src/s_logl.c \
src/lib/libm/src/s_lrintl.c src/lib/libm/src/s_remquol.c
cvs rdiff -u -r1.4 -r1.5 src/lib/libm/src/s_fabsl.c \
src/lib/libm/src/s_nearbyint.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/lib/libm/src

2024-02-23 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Feb 23 13:42:01 UTC 2024

Modified Files:
src/lib/libm/src: s_tanl.c

Log Message:
fix the 32 bit tanl symbol.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/lib/libm/src/s_tanl.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_tanl.c
diff -u src/lib/libm/src/s_tanl.c:1.1 src/lib/libm/src/s_tanl.c:1.2
--- src/lib/libm/src/s_tanl.c:1.1	Sun Jan 21 13:53:19 2024
+++ src/lib/libm/src/s_tanl.c	Fri Feb 23 08:42:01 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: s_tanl.c,v 1.1 2024/01/21 18:53:19 christos Exp $	*/
+/*	$NetBSD: s_tanl.c,v 1.2 2024/02/23 13:42:01 christos Exp $	*/
 
 /*-
  * SPDX-License-Identifier: BSD-2-Clause
@@ -29,7 +29,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: s_tanl.c,v 1.1 2024/01/21 18:53:19 christos Exp $");
+__RCSID("$NetBSD: s_tanl.c,v 1.2 2024/02/23 13:42:01 christos Exp $");
 
 /*
  * Limited testing on pseudorandom numbers drawn within [0:4e8] shows
@@ -45,12 +45,12 @@ __RCSID("$NetBSD: s_tanl.c,v 1.1 2024/01
 #include "math.h"
 #include "math_private.h"
 
-#ifdef __HAVE_LONG_DOUBLE
-
 #ifdef __weak_alias
 __weak_alias(tanl, _tanl)
 #endif
 
+#ifdef __HAVE_LONG_DOUBLE
+
 #if LDBL_MANT_DIG == 64
 #include "../ld80/e_rem_pio2l.h"
 #include "../ld80/k_tanl.c"
@@ -109,8 +109,10 @@ tanl(long double x)
 
 #else
 
-#ifdef __weak_alias
-__weak_alias(tanl, tan)
-#endif
+long double
+tanl(long double x)
+{
+	return tan(x);
+}
 
 #endif



CVS commit: src/lib/libm/src

2024-02-23 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Feb 23 13:42:01 UTC 2024

Modified Files:
src/lib/libm/src: s_tanl.c

Log Message:
fix the 32 bit tanl symbol.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/lib/libm/src/s_tanl.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/lib/libm/src

2024-01-26 Thread Ryo ONODERA
Module Name:src
Committed By:   ryoon
Date:   Sat Jan 27 05:50:42 UTC 2024

Modified Files:
src/lib/libm/src: e_acoshl.c e_acosl.c e_asinl.c e_atanhl.c e_coshl.c
s_asinhl.c s_logl.c s_tanhl.c

Log Message:
Enable asinl, acosl, logl, coshl, tanhl, atanhl, asinhl and acoshl

* Fix pkgsrc/math/py-numpy and pkgsrc/graphics/py-matplotlib, for example.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/lib/libm/src/e_acoshl.c \
src/lib/libm/src/e_acosl.c src/lib/libm/src/e_asinl.c \
src/lib/libm/src/e_atanhl.c src/lib/libm/src/e_coshl.c \
src/lib/libm/src/s_asinhl.c src/lib/libm/src/s_tanhl.c
cvs rdiff -u -r1.2 -r1.3 src/lib/libm/src/s_logl.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/lib/libm/src

2024-01-26 Thread Ryo ONODERA
Module Name:src
Committed By:   ryoon
Date:   Sat Jan 27 05:50:42 UTC 2024

Modified Files:
src/lib/libm/src: e_acoshl.c e_acosl.c e_asinl.c e_atanhl.c e_coshl.c
s_asinhl.c s_logl.c s_tanhl.c

Log Message:
Enable asinl, acosl, logl, coshl, tanhl, atanhl, asinhl and acoshl

* Fix pkgsrc/math/py-numpy and pkgsrc/graphics/py-matplotlib, for example.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/lib/libm/src/e_acoshl.c \
src/lib/libm/src/e_acosl.c src/lib/libm/src/e_asinl.c \
src/lib/libm/src/e_atanhl.c src/lib/libm/src/e_coshl.c \
src/lib/libm/src/s_asinhl.c src/lib/libm/src/s_tanhl.c
cvs rdiff -u -r1.2 -r1.3 src/lib/libm/src/s_logl.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_acoshl.c
diff -u src/lib/libm/src/e_acoshl.c:1.1 src/lib/libm/src/e_acoshl.c:1.2
--- src/lib/libm/src/e_acoshl.c:1.1	Sun Jan 21 18:53:17 2024
+++ src/lib/libm/src/e_acoshl.c	Sat Jan 27 05:50:42 2024
@@ -16,6 +16,12 @@
 
 #include "namespace.h"
 
+#include 
+#include 
+
+#include "math.h"
+#include "math_private.h"
+
 #ifdef __HAVE_LONG_DOUBLE
 __weak_alias(acoshl, _acoshl)
 
@@ -26,14 +32,10 @@ __weak_alias(acoshl, _acoshl)
  * Bruce D. Evans.
  */
 
-#include 
 #ifdef __i386__
 #include 
 #endif
 
-#include "math.h"
-#include "math_private.h"
-
 /* EXP_LARGE is the threshold above which we use acosh(x) ~= log(2x). */
 #if LDBL_MANT_DIG == 64
 #define	EXP_LARGE	34
Index: src/lib/libm/src/e_acosl.c
diff -u src/lib/libm/src/e_acosl.c:1.1 src/lib/libm/src/e_acosl.c:1.2
--- src/lib/libm/src/e_acosl.c:1.1	Sun Jan 21 18:53:17 2024
+++ src/lib/libm/src/e_acosl.c	Sat Jan 27 05:50:42 2024
@@ -19,6 +19,10 @@
 #include "namespace.h"
 
 #include 
+#include 
+
+#include "math.h"
+#include "math_private.h"
 
 #ifdef __HAVE_LONG_DOUBLE
 __weak_alias(acosl, _acosl)
@@ -30,8 +34,6 @@ __weak_alias(acosl, _acosl)
 #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/e_asinl.c
diff -u src/lib/libm/src/e_asinl.c:1.1 src/lib/libm/src/e_asinl.c:1.2
--- src/lib/libm/src/e_asinl.c:1.1	Sun Jan 21 18:53:17 2024
+++ src/lib/libm/src/e_asinl.c	Sat Jan 27 05:50:42 2024
@@ -19,6 +19,10 @@
 
 #include "namespace.h"
 #include 
+#include 
+
+#include "math.h"
+#include "math_private.h"
 
 #ifdef __HAVE_LONG_DOUBLE
 
@@ -31,8 +35,6 @@ __weak_alias(asinl, _asinl)
 #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/e_atanhl.c
diff -u src/lib/libm/src/e_atanhl.c:1.1 src/lib/libm/src/e_atanhl.c:1.2
--- src/lib/libm/src/e_atanhl.c:1.1	Sun Jan 21 18:53:17 2024
+++ src/lib/libm/src/e_atanhl.c	Sat Jan 27 05:50:42 2024
@@ -17,6 +17,10 @@
 #include "namespace.h"
 
 #include 
+#include 
+
+#include "math.h"
+#include "math_private.h"
 
 #ifdef __HAVE_LONG_DOUBLE
 __weak_alias(atanhl, _atanhl)
@@ -31,9 +35,6 @@ __weak_alias(atanhl, _atanhl)
 #include 
 #endif
 
-#include "math.h"
-#include "math_private.h"
-
 /* EXP_TINY is the threshold below which we use atanh(x) ~= x. */
 #if LDBL_MANT_DIG == 64
 #define	EXP_TINY	-34
Index: src/lib/libm/src/e_coshl.c
diff -u src/lib/libm/src/e_coshl.c:1.1 src/lib/libm/src/e_coshl.c:1.2
--- src/lib/libm/src/e_coshl.c:1.1	Sun Jan 21 18:53:17 2024
+++ src/lib/libm/src/e_coshl.c	Sat Jan 27 05:50:42 2024
@@ -24,6 +24,7 @@
 __weak_alias(coshl, _coshl)
 
 #ifdef __HAVE_LONG_DOUBLE
+#error SHOULD STOP HERE!!!
 
 #ifdef __i386__
 #include 
Index: src/lib/libm/src/s_asinhl.c
diff -u src/lib/libm/src/s_asinhl.c:1.1 src/lib/libm/src/s_asinhl.c:1.2
--- src/lib/libm/src/s_asinhl.c:1.1	Sun Jan 21 18:53:18 2024
+++ src/lib/libm/src/s_asinhl.c	Sat Jan 27 05:50:42 2024
@@ -16,6 +16,10 @@
 #include "namespace.h"
 
 #include 
+#include 
+
+#include "math.h"
+#include "math_private.h"
 
 #ifdef __HAVE_LONG_DOUBLE
 __weak_alias(asinhl, _asinhl)
@@ -31,9 +35,6 @@ __weak_alias(asinhl, _asinhl)
 #include 
 #endif
 
-#include "math.h"
-#include "math_private.h"
-
 /* EXP_LARGE is the threshold above which we use asinh(x) ~= log(2x). */
 /* EXP_TINY is the threshold below which we use asinh(x) ~= x. */
 #if LDBL_MANT_DIG == 64
Index: src/lib/libm/src/s_tanhl.c
diff -u src/lib/libm/src/s_tanhl.c:1.1 src/lib/libm/src/s_tanhl.c:1.2
--- src/lib/libm/src/s_tanhl.c:1.1	Sun Jan 21 18:53:19 2024
+++ src/lib/libm/src/s_tanhl.c	Sat Jan 27 05:50:42 2024
@@ -15,6 +15,10 @@
 
 #include "namespace.h"
 #include 
+#include 
+
+#include "math.h"
+#include "math_private.h"
 
 #ifdef __HAVE_LONG_DOUBLE
 __weak_alias(tanhl, _tanhl)
@@ -28,8 +32,6 @@ __weak_alias(tanhl, _tanhl)
 #include 
 #endif
 
-#include "math.h"
-#include "math_private.h"
 #if LDBL_MANT_DIG == 64
 #include "../ld80/k_expl.h"
 #elif LDBL_MANT_DIG == 113

Index: src/lib/libm/src/s_logl.c
diff -u 

CVS commit: src/lib/libm/src

2024-01-26 Thread Ryo ONODERA
Module Name:src
Committed By:   ryoon
Date:   Fri Jan 26 12:32:49 UTC 2024

Modified Files:
src/lib/libm/src: s_sinl.c

Log Message:
Fix inverted logic for weak alias

* Fix gfortran from pkgsrc/lang/gcc10 and pkgsrc/math/coinmp, for example.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/lib/libm/src/s_sinl.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_sinl.c
diff -u src/lib/libm/src/s_sinl.c:1.1 src/lib/libm/src/s_sinl.c:1.2
--- src/lib/libm/src/s_sinl.c:1.1	Sun Jan 21 18:53:19 2024
+++ src/lib/libm/src/s_sinl.c	Fri Jan 26 12:32:49 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: s_sinl.c,v 1.1 2024/01/21 18:53:19 christos Exp $	*/
+/*	$NetBSD: s_sinl.c,v 1.2 2024/01/26 12:32:49 ryoon Exp $	*/
 
 /*-
  * SPDX-License-Identifier: BSD-2-Clause
@@ -29,7 +29,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: s_sinl.c,v 1.1 2024/01/21 18:53:19 christos Exp $");
+__RCSID("$NetBSD: s_sinl.c,v 1.2 2024/01/26 12:32:49 ryoon Exp $");
 
 #include "namespace.h"
 #include 
@@ -37,7 +37,7 @@ __RCSID("$NetBSD: s_sinl.c,v 1.1 2024/01
 #include 
 #endif
 
-#ifndef __weak_alias
+#ifdef __weak_alias
 __weak_alias(sinl, _sinl)
 #endif
 



CVS commit: src/lib/libm/src

2024-01-26 Thread Ryo ONODERA
Module Name:src
Committed By:   ryoon
Date:   Fri Jan 26 12:32:49 UTC 2024

Modified Files:
src/lib/libm/src: s_sinl.c

Log Message:
Fix inverted logic for weak alias

* Fix gfortran from pkgsrc/lang/gcc10 and pkgsrc/math/coinmp, for example.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/lib/libm/src/s_sinl.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/lib/libm/src

2024-01-23 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Jan 23 15:45:07 UTC 2024

Modified Files:
src/lib/libm/src: b_tgammal.c e_atan2l.c e_lgammal_r.c math_private.h
s_atanl.c s_cospil.c s_erfl.c s_exp2l.c s_expl.c s_logl.c
s_remquol.c s_sinpil.c s_tanpil.c

Log Message:
move inclusion of  to the ieee source files instead of
including it in math_private.h which is also used by the vax which is not ieee.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/lib/libm/src/b_tgammal.c \
src/lib/libm/src/e_atan2l.c src/lib/libm/src/e_lgammal_r.c \
src/lib/libm/src/s_cospil.c src/lib/libm/src/s_erfl.c \
src/lib/libm/src/s_exp2l.c src/lib/libm/src/s_expl.c \
src/lib/libm/src/s_logl.c src/lib/libm/src/s_sinpil.c \
src/lib/libm/src/s_tanpil.c
cvs rdiff -u -r1.30 -r1.31 src/lib/libm/src/math_private.h
cvs rdiff -u -r1.2 -r1.3 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.



CVS commit: src/lib/libm/src

2024-01-23 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Jan 23 15:45:07 UTC 2024

Modified Files:
src/lib/libm/src: b_tgammal.c e_atan2l.c e_lgammal_r.c math_private.h
s_atanl.c s_cospil.c s_erfl.c s_exp2l.c s_expl.c s_logl.c
s_remquol.c s_sinpil.c s_tanpil.c

Log Message:
move inclusion of  to the ieee source files instead of
including it in math_private.h which is also used by the vax which is not ieee.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/lib/libm/src/b_tgammal.c \
src/lib/libm/src/e_atan2l.c src/lib/libm/src/e_lgammal_r.c \
src/lib/libm/src/s_cospil.c src/lib/libm/src/s_erfl.c \
src/lib/libm/src/s_exp2l.c src/lib/libm/src/s_expl.c \
src/lib/libm/src/s_logl.c src/lib/libm/src/s_sinpil.c \
src/lib/libm/src/s_tanpil.c
cvs rdiff -u -r1.30 -r1.31 src/lib/libm/src/math_private.h
cvs rdiff -u -r1.2 -r1.3 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/lib/libm/src/b_tgammal.c
diff -u src/lib/libm/src/b_tgammal.c:1.1 src/lib/libm/src/b_tgammal.c:1.2
--- src/lib/libm/src/b_tgammal.c:1.1	Sun Jan 21 13:53:17 2024
+++ src/lib/libm/src/b_tgammal.c	Tue Jan 23 10:45:07 2024
@@ -1,4 +1,4 @@
-/* 	$NetBSD: b_tgammal.c,v 1.1 2024/01/21 18:53:17 christos Exp $	*/
+/* 	$NetBSD: b_tgammal.c,v 1.2 2024/01/23 15:45:07 christos Exp $	*/
 
 /*-
  * Copyright (c) 2023 The NetBSD Foundation, Inc.
@@ -30,12 +30,13 @@
  */
 #include 
 #if defined(LIBM_SCCS) && !defined(lint)
-__RCSID("$NetBSD: b_tgammal.c,v 1.1 2024/01/21 18:53:17 christos Exp $");
+__RCSID("$NetBSD: b_tgammal.c,v 1.2 2024/01/23 15:45:07 christos Exp $");
 #endif
 
 #include "namespace.h"
 #include "math.h"
 #include 
+#include 
 
 
 #ifdef __HAVE_LONG_DOUBLE
Index: src/lib/libm/src/e_atan2l.c
diff -u src/lib/libm/src/e_atan2l.c:1.1 src/lib/libm/src/e_atan2l.c:1.2
--- src/lib/libm/src/e_atan2l.c:1.1	Sun Jan 21 13:53:17 2024
+++ src/lib/libm/src/e_atan2l.c	Tue Jan 23 10:45:07 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: e_atan2l.c,v 1.1 2024/01/21 18:53:17 christos Exp $	*/
+/*	$NetBSD: e_atan2l.c,v 1.2 2024/01/23 15:45:07 christos Exp $	*/
 /* @(#)e_atan2.c 1.3 95/01/18 */
 /* FreeBSD: head/lib/msun/src/e_atan2.c 176451 2008-02-22 02:30:36Z das */
 /*
@@ -14,7 +14,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: e_atan2l.c,v 1.1 2024/01/21 18:53:17 christos Exp $");
+__RCSID("$NetBSD: e_atan2l.c,v 1.2 2024/01/23 15:45:07 christos Exp $");
 
 /*
  * See comments in e_atan2.c.
@@ -28,6 +28,7 @@ __weak_alias(atan2l, _atan2l)
 #endif
 
 #include 
+#include 
 
 #include "math.h"
 #include "math_private.h"
Index: src/lib/libm/src/e_lgammal_r.c
diff -u src/lib/libm/src/e_lgammal_r.c:1.1 src/lib/libm/src/e_lgammal_r.c:1.2
--- src/lib/libm/src/e_lgammal_r.c:1.1	Sun Jan 21 13:53:18 2024
+++ src/lib/libm/src/e_lgammal_r.c	Tue Jan 23 10:45:07 2024
@@ -1,4 +1,4 @@
-/* 	$NetBSD: e_lgammal_r.c,v 1.1 2024/01/21 18:53:18 christos Exp $	*/
+/* 	$NetBSD: e_lgammal_r.c,v 1.2 2024/01/23 15:45:07 christos Exp $	*/
 
 /*-
  * Copyright (c) 2023 The NetBSD Foundation, Inc.
@@ -30,12 +30,13 @@
  */
 #include 
 #if defined(LIBM_SCCS) && !defined(lint)
-__RCSID("$NetBSD: e_lgammal_r.c,v 1.1 2024/01/21 18:53:18 christos Exp $");
+__RCSID("$NetBSD: e_lgammal_r.c,v 1.2 2024/01/23 15:45:07 christos Exp $");
 #endif
 
 #include "namespace.h"
 #include "math.h"
 #include 
+#include 
 
 #ifdef __weak_alias
 __weak_alias(lgammal_r,_lgammal_r)
Index: src/lib/libm/src/s_cospil.c
diff -u src/lib/libm/src/s_cospil.c:1.1 src/lib/libm/src/s_cospil.c:1.2
--- src/lib/libm/src/s_cospil.c:1.1	Sun Jan 21 13:53:18 2024
+++ src/lib/libm/src/s_cospil.c	Tue Jan 23 10:45:07 2024
@@ -1,4 +1,4 @@
-/* 	$NetBSD: s_cospil.c,v 1.1 2024/01/21 18:53:18 christos Exp $	*/
+/* 	$NetBSD: s_cospil.c,v 1.2 2024/01/23 15:45:07 christos Exp $	*/
 
 /*-
  * Copyright (c) 2023 The NetBSD Foundation, Inc.
@@ -30,12 +30,13 @@
  */
 #include 
 #if defined(LIBM_SCCS) && !defined(lint)
-__RCSID("$NetBSD: s_cospil.c,v 1.1 2024/01/21 18:53:18 christos Exp $");
+__RCSID("$NetBSD: s_cospil.c,v 1.2 2024/01/23 15:45:07 christos Exp $");
 #endif
 
 #include "namespace.h"
 #include "math.h"
 #include 
+#include 
 
 
 #ifdef __HAVE_LONG_DOUBLE
Index: src/lib/libm/src/s_erfl.c
diff -u src/lib/libm/src/s_erfl.c:1.1 src/lib/libm/src/s_erfl.c:1.2
--- src/lib/libm/src/s_erfl.c:1.1	Sun Jan 21 13:53:18 2024
+++ src/lib/libm/src/s_erfl.c	Tue Jan 23 10:45:07 2024
@@ -1,4 +1,4 @@
-/* 	$NetBSD: s_erfl.c,v 1.1 2024/01/21 18:53:18 christos Exp $	*/
+/* 	$NetBSD: s_erfl.c,v 1.2 2024/01/23 15:45:07 christos Exp $	*/
 
 /*-
  * Copyright (c) 2023 The NetBSD Foundation, Inc.
@@ -30,12 +30,13 @@
  */
 #include 
 #if defined(LIBM_SCCS) && !defined(lint)
-__RCSID("$NetBSD: s_erfl.c,v 1.1 2024/01/21 18:53:18 christos Exp $");
+__RCSID("$NetBSD: s_erfl.c,v 1.2 2024/01/23 15:45:07 christos Exp $");
 #endif
 
 #include "namespace.h"
 #include 

CVS commit: src/lib/libm/src

2024-01-22 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Mon Jan 22 14:26:18 UTC 2024

Modified Files:
src/lib/libm/src: math_private.h

Log Message:
Simply an overly complex way of saying "0 or 1" into a cleaner version.

While here add a commment about how the __i386__ magic LD80C macro
might no longer work on all other arch's as well (if someone can verify
that it still does, or can fix it so that it still works on i386, but
also works everywhere else, then please remove that XXX comment.
The issue I am (perhaps imagining) is the (uint32_t) cast.


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.30 src/lib/libm/src/math_private.h

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/math_private.h
diff -u src/lib/libm/src/math_private.h:1.29 src/lib/libm/src/math_private.h:1.30
--- src/lib/libm/src/math_private.h:1.29	Mon Jan 22 12:15:19 2024
+++ src/lib/libm/src/math_private.h	Mon Jan 22 14:26:18 2024
@@ -11,7 +11,7 @@
 
 /*
  * from: @(#)fdlibm.h 5.1 93/09/24
- * $NetBSD: math_private.h,v 1.29 2024/01/22 12:15:19 kre Exp $
+ * $NetBSD: math_private.h,v 1.30 2024/01/22 14:26:18 kre Exp $
  */
 
 #ifndef _MATH_PRIVATE_H_
@@ -321,9 +321,10 @@ do {\
 	.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,		\
+	.extu_sign = ((v) < 0),		\
 }
 #else
+/**XXX: the following comment may no longer be true:  kre 20240122 **/
 /* The above works on non-i386 too, but we use this to check v. */
 #define	LD80C(m, ex, v)	{ .extu_ld = (v), }
 #endif



CVS commit: src/lib/libm/src

2024-01-22 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Mon Jan 22 14:26:18 UTC 2024

Modified Files:
src/lib/libm/src: math_private.h

Log Message:
Simply an overly complex way of saying "0 or 1" into a cleaner version.

While here add a commment about how the __i386__ magic LD80C macro
might no longer work on all other arch's as well (if someone can verify
that it still does, or can fix it so that it still works on i386, but
also works everywhere else, then please remove that XXX comment.
The issue I am (perhaps imagining) is the (uint32_t) cast.


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.30 src/lib/libm/src/math_private.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/lib/libm/src

2023-08-08 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Tue Aug  8 06:31:18 UTC 2023

Modified Files:
src/lib/libm/src: k_rem_pio2.c k_rem_pio2f.c

Log Message:
avoid uninitialised variable accesses.

if __kernel_rem_pio2() or __kernel_rem_pio2f() are called with "nx" less
than 2, the local variable fq[0] may be accessed uninitialised.

__kernel_rem_pio2() has direct calls with nx = 1, and __kernel_rem_pio2f()
is called with a value starting at 3, but may be decreased to less than 2,
implied by this code , if not actually avoided by the tx[] setup above:
nx = 3;
while(tx[nx-1]==zero) nx--; /* skip zero term */
n  =  __kernel_rem_pio2f(tx,y,e0,nx,2,two_over_pi);

found by GCC 12.


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/lib/libm/src/k_rem_pio2.c
cvs rdiff -u -r1.9 -r1.10 src/lib/libm/src/k_rem_pio2f.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/k_rem_pio2.c
diff -u src/lib/libm/src/k_rem_pio2.c:1.14 src/lib/libm/src/k_rem_pio2.c:1.15
--- src/lib/libm/src/k_rem_pio2.c:1.14	Wed Aug 24 13:51:19 2022
+++ src/lib/libm/src/k_rem_pio2.c	Tue Aug  8 06:31:17 2023
@@ -16,7 +16,7 @@
 __FBSDID("$FreeBSD: head/lib/msun/src/k_rem_pio2.c 342651 2018-12-31 15:43:06Z pfg $");
 #endif
 #if defined(LIBM_SCCS) && !defined(lint)
-__RCSID("$NetBSD: k_rem_pio2.c,v 1.14 2022/08/24 13:51:19 christos Exp $");
+__RCSID("$NetBSD: k_rem_pio2.c,v 1.15 2023/08/08 06:31:17 mrg Exp $");
 #endif
 
 /*
@@ -302,6 +302,11 @@ __kernel_rem_pio2(double *x, double *y, 
 	int32_t jz,jx,jv,jp,jk,carry,n,iq[20],i,j,k,m,q0,ih;
 	double z,fw,f[20],fq[20],q[20];
 
+/* if nx < 2, fq[0] may be accessed uninitialised */
+	if (nx < 2) {
+	fq[0] = 0;
+	}
+
 /* initialize jk*/
 	jk = init_jk[prec];
 	jp = jk;

Index: src/lib/libm/src/k_rem_pio2f.c
diff -u src/lib/libm/src/k_rem_pio2f.c:1.9 src/lib/libm/src/k_rem_pio2f.c:1.10
--- src/lib/libm/src/k_rem_pio2f.c:1.9	Thu Jun 22 12:43:43 2017
+++ src/lib/libm/src/k_rem_pio2f.c	Tue Aug  8 06:31:17 2023
@@ -15,7 +15,7 @@
 
 #include 
 #if defined(LIBM_SCCS) && !defined(lint)
-__RCSID("$NetBSD: k_rem_pio2f.c,v 1.9 2017/06/22 12:43:43 maya Exp $");
+__RCSID("$NetBSD: k_rem_pio2f.c,v 1.10 2023/08/08 06:31:17 mrg Exp $");
 #endif
 
 #include "namespace.h"
@@ -53,6 +53,11 @@ __kernel_rem_pio2f(float *x, float *y, i
 	int32_t jz,jx,jv,jp,jk,carry,n,iq[20],i,j,k,m,q0,ih;
 	float z,fw,f[20],fq[20],q[20];
 
+/* if nx < 2, fq[0] may be accessed uninitialised */
+	if (nx < 2) {
+	fq[0] = 0;
+	}
+
 /* initialize jk*/
 	jk = init_jk[prec];
 	jp = jk;



CVS commit: src/lib/libm/src

2023-08-08 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Tue Aug  8 06:31:18 UTC 2023

Modified Files:
src/lib/libm/src: k_rem_pio2.c k_rem_pio2f.c

Log Message:
avoid uninitialised variable accesses.

if __kernel_rem_pio2() or __kernel_rem_pio2f() are called with "nx" less
than 2, the local variable fq[0] may be accessed uninitialised.

__kernel_rem_pio2() has direct calls with nx = 1, and __kernel_rem_pio2f()
is called with a value starting at 3, but may be decreased to less than 2,
implied by this code , if not actually avoided by the tx[] setup above:
nx = 3;
while(tx[nx-1]==zero) nx--; /* skip zero term */
n  =  __kernel_rem_pio2f(tx,y,e0,nx,2,two_over_pi);

found by GCC 12.


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/lib/libm/src/k_rem_pio2.c
cvs rdiff -u -r1.9 -r1.10 src/lib/libm/src/k_rem_pio2f.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/lib/libm/src

2023-08-07 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Mon Aug  7 08:54:40 UTC 2023

Modified Files:
src/lib/libm/src: ldbl_dummy.c

Log Message:
libm: Add dummy remainderl and remquol.

These are pretty bad -- these aren't transcendental functions; not
rocket science to make them correctly rounded -- but let's just make
sure they're available in libm for netbsd-10.

XXX pullup-10


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/lib/libm/src/ldbl_dummy.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/ldbl_dummy.c
diff -u src/lib/libm/src/ldbl_dummy.c:1.3 src/lib/libm/src/ldbl_dummy.c:1.4
--- src/lib/libm/src/ldbl_dummy.c:1.3	Mon Mar 13 18:18:36 2023
+++ src/lib/libm/src/ldbl_dummy.c	Mon Aug  7 08:54:40 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: ldbl_dummy.c,v 1.3 2023/03/13 18:18:36 riastradh Exp $ */
+/* $NetBSD: ldbl_dummy.c,v 1.4 2023/08/07 08:54:40 riastradh Exp $ */
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: ldbl_dummy.c,v 1.3 2023/03/13 18:18:36 riastradh Exp $");
+__RCSID("$NetBSD: ldbl_dummy.c,v 1.4 2023/08/07 08:54:40 riastradh Exp $");
 
 #include "namespace.h"
 #include 
@@ -222,3 +222,15 @@ tgammal(long double x)
 {
 	return tgamma(x);
 }
+
+long double
+remainderl(long double x, long double y)
+{
+	return remainder(x, y);
+}
+
+long double
+remquol(long double x, long double y, int *quo)
+{
+	return remquo(x, y, quo);
+}



CVS commit: src/lib/libm/src

2023-08-07 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Mon Aug  7 08:54:40 UTC 2023

Modified Files:
src/lib/libm/src: ldbl_dummy.c

Log Message:
libm: Add dummy remainderl and remquol.

These are pretty bad -- these aren't transcendental functions; not
rocket science to make them correctly rounded -- but let's just make
sure they're available in libm for netbsd-10.

XXX pullup-10


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/lib/libm/src/ldbl_dummy.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



re: CVS commit: src/lib/libm/src

2023-03-15 Thread matthew green
"Taylor R Campbell" writes:
> Module Name:  src
> Committed By: riastradh
> Date: Mon Mar 13 18:18:36 UTC 2023
>
> Modified Files:
>   src/lib/libm/src: ldbl_dummy.c
>
> Log Message:
> libm: Fill in more dummy long double transcendental functions.
>
> This should cover everything from C99.

bump shlib minor?


.mrg.


CVS commit: src/lib/libm/src

2023-03-13 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Tue Mar 14 05:49:03 UTC 2023

Modified Files:
src/lib/libm/src: namespace.h

Log Message:
Add (newly added): expm1l log1pl log2l lgammal tgammal
so that the library gets the correct symbols defined in it.


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/lib/libm/src/namespace.h

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/namespace.h
diff -u src/lib/libm/src/namespace.h:1.16 src/lib/libm/src/namespace.h:1.17
--- src/lib/libm/src/namespace.h:1.16	Sat Aug 27 08:31:59 2022
+++ src/lib/libm/src/namespace.h	Tue Mar 14 05:49:03 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: namespace.h,v 1.16 2022/08/27 08:31:59 christos Exp $ */
+/* $NetBSD: namespace.h,v 1.17 2023/03/14 05:49:03 kre Exp $ */
 
 #define atan2 _atan2
 #define atan2f _atan2f
@@ -10,6 +10,7 @@
 #define exp _exp
 #define expf _expf
 #define expl _expl
+#define expm1l _expm1l
 #define log _log
 #define logf _logf
 #define logl _logl
@@ -73,9 +74,14 @@
 #define tanhl _tanhl
 #define atanhl _atanhl
 #define log10l _log10l
+#define log1pl _log1pl
+#define log2l _log2l
 
-#define erfl	_erfl
-#define erfcl	_erfcl
+#define erfl _erfl
+#define erfcl _erfcl
+
+#define lgammal _lgammal
+#define tgammal _tgammal
 
 #define feclearexcept _feclearexcept
 #define fegetenv _fegetenv



CVS commit: src/lib/libm/src

2023-03-13 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Tue Mar 14 05:49:03 UTC 2023

Modified Files:
src/lib/libm/src: namespace.h

Log Message:
Add (newly added): expm1l log1pl log2l lgammal tgammal
so that the library gets the correct symbols defined in it.


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/lib/libm/src/namespace.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/lib/libm/src

2023-03-13 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Mon Mar 13 18:26:32 UTC 2023

Modified Files:
src/lib/libm/src: s_llrintl.c s_lrintl.c

Log Message:
libm: Need  for __HAVE_LONG_DOUBLE.

Fixes missing definitions of lrintl, llrintl on various platforms.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/lib/libm/src/s_llrintl.c \
src/lib/libm/src/s_lrintl.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_llrintl.c
diff -u src/lib/libm/src/s_llrintl.c:1.2 src/lib/libm/src/s_llrintl.c:1.3
--- src/lib/libm/src/s_llrintl.c:1.2	Sun May  7 11:29:21 2017
+++ src/lib/libm/src/s_llrintl.c	Mon Mar 13 18:26:32 2023
@@ -2,9 +2,11 @@
 #ifdef __FreeBSD__
 __FBSDID("$FreeBSD: head/lib/msun/src/s_llrintl.c 175309 2008-01-14 02:12:07Z das $");
 #else
-__RCSID("$NetBSD: s_llrintl.c,v 1.2 2017/05/07 11:29:21 martin Exp $");
+__RCSID("$NetBSD: s_llrintl.c,v 1.3 2023/03/13 18:26:32 riastradh Exp $");
 #endif
 
+#include 
+
 #ifdef __HAVE_LONG_DOUBLE
 #define stype		long double
 #define	roundit		rintl
Index: src/lib/libm/src/s_lrintl.c
diff -u src/lib/libm/src/s_lrintl.c:1.2 src/lib/libm/src/s_lrintl.c:1.3
--- src/lib/libm/src/s_lrintl.c:1.2	Sun May  7 11:29:21 2017
+++ src/lib/libm/src/s_lrintl.c	Mon Mar 13 18:26:32 2023
@@ -2,9 +2,11 @@
 #ifdef __FreeBSD__
 __FBSDID("$FreeBSD: head/lib/msun/src/s_lrintl.c 175309 2008-01-14 02:12:07Z das $");
 #else
-__RCSID("$NetBSD: s_lrintl.c,v 1.2 2017/05/07 11:29:21 martin Exp $");
+__RCSID("$NetBSD: s_lrintl.c,v 1.3 2023/03/13 18:26:32 riastradh Exp $");
 #endif
 
+#include 
+
 #ifdef __HAVE_LONG_DOUBLE
 #define stype		long double
 #define	roundit		rintl



CVS commit: src/lib/libm/src

2023-03-13 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Mon Mar 13 18:26:32 UTC 2023

Modified Files:
src/lib/libm/src: s_llrintl.c s_lrintl.c

Log Message:
libm: Need  for __HAVE_LONG_DOUBLE.

Fixes missing definitions of lrintl, llrintl on various platforms.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/lib/libm/src/s_llrintl.c \
src/lib/libm/src/s_lrintl.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/lib/libm/src

2023-03-13 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Mon Mar 13 18:18:36 UTC 2023

Modified Files:
src/lib/libm/src: ldbl_dummy.c

Log Message:
libm: Fill in more dummy long double transcendental functions.

This should cover everything from C99.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/lib/libm/src/ldbl_dummy.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/ldbl_dummy.c
diff -u src/lib/libm/src/ldbl_dummy.c:1.2 src/lib/libm/src/ldbl_dummy.c:1.3
--- src/lib/libm/src/ldbl_dummy.c:1.2	Thu Nov 13 21:43:27 2014
+++ src/lib/libm/src/ldbl_dummy.c	Mon Mar 13 18:18:36 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: ldbl_dummy.c,v 1.2 2014/11/13 21:43:27 christos Exp $ */
+/* $NetBSD: ldbl_dummy.c,v 1.3 2023/03/13 18:18:36 riastradh Exp $ */
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: ldbl_dummy.c,v 1.2 2014/11/13 21:43:27 christos Exp $");
+__RCSID("$NetBSD: ldbl_dummy.c,v 1.3 2023/03/13 18:18:36 riastradh Exp $");
 
 #include "namespace.h"
 #include 
@@ -43,8 +43,11 @@ __weak_alias(atan2l, _atan2l)
 __weak_alias(hypotl, _hypotl)
 __weak_alias(logl, _logl)
 __weak_alias(log10l, _log10l)
+__weak_alias(log2l, _log2l)
+__weak_alias(log1pl, _log1pl)
 __weak_alias(expl, _expl)
 __weak_alias(exp2l, _exp2l)
+__weak_alias(expm1l, _expm1l)
 __weak_alias(powl, _powl)
 __weak_alias(cosl, _cosl)
 __weak_alias(sinl, _sinl)
@@ -60,6 +63,8 @@ __weak_alias(asinhl, _asinhl)
 __weak_alias(atanhl, _atanhl)
 __weak_alias(erfl, _erfl)
 __weak_alias(erfcl, _erfcl)
+__weak_alias(lgammal, _lgammal)
+__weak_alias(tgammal, _tgammal)
 
 long double
 atan2l(long double y, long double x)
@@ -86,6 +91,18 @@ log10l(long double x)
 }
 
 long double
+log2l(long double x)
+{
+	return log2(x);
+}
+
+long double
+log1pl(long double x)
+{
+	return log1p(x);
+}
+
+long double
 expl(long double x)
 {
 	return exp(x);
@@ -98,6 +115,12 @@ exp2l(long double x)
 }
 
 long double
+expm1l(long double x)
+{
+	return expm1(x);
+}
+
+long double
 powl(long double x, long double y)
 {
 	return pow(x, y);
@@ -187,3 +210,15 @@ erfcl(long double x)
 {
 	return erfc(x);
 }
+
+long double
+lgammal(long double x)
+{
+	return lgamma(x);
+}
+
+long double
+tgammal(long double x)
+{
+	return tgamma(x);
+}



CVS commit: src/lib/libm/src

2023-03-13 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Mon Mar 13 18:18:36 UTC 2023

Modified Files:
src/lib/libm/src: ldbl_dummy.c

Log Message:
libm: Fill in more dummy long double transcendental functions.

This should cover everything from C99.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/lib/libm/src/ldbl_dummy.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/lib/libm/src

2022-08-28 Thread Havard Eidnes
Module Name:src
Committed By:   he
Date:   Sun Aug 28 21:24:09 UTC 2022

Modified Files:
src/lib/libm/src: s_rint.c

Log Message:
s_rint.c: weak-alias rintl -> rint for ports without __HAVE_LONG_DOUBLE.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/lib/libm/src/s_rint.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_rint.c
diff -u src/lib/libm/src/s_rint.c:1.12 src/lib/libm/src/s_rint.c:1.13
--- src/lib/libm/src/s_rint.c:1.12	Fri Apr 25 22:21:53 2008
+++ src/lib/libm/src/s_rint.c	Sun Aug 28 21:24:09 2022
@@ -12,7 +12,7 @@
 
 #include 
 #if defined(LIBM_SCCS) && !defined(lint)
-__RCSID("$NetBSD: s_rint.c,v 1.12 2008/04/25 22:21:53 christos Exp $");
+__RCSID("$NetBSD: s_rint.c,v 1.13 2022/08/28 21:24:09 he Exp $");
 #endif
 
 /*
@@ -77,3 +77,7 @@ rint(double x)
 	w = TWO52[sx]+x;
 	return w-TWO52[sx];
 }
+
+#if !defined(__HAVE_LONG_DOUBLE)
+__weak_alias(rintl, rint)
+#endif



CVS commit: src/lib/libm/src

2022-08-28 Thread Havard Eidnes
Module Name:src
Committed By:   he
Date:   Sun Aug 28 21:24:09 UTC 2022

Modified Files:
src/lib/libm/src: s_rint.c

Log Message:
s_rint.c: weak-alias rintl -> rint for ports without __HAVE_LONG_DOUBLE.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/lib/libm/src/s_rint.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/lib/libm/src

2022-08-28 Thread Havard Eidnes
Module Name:src
Committed By:   he
Date:   Sun Aug 28 16:07:58 UTC 2022

Modified Files:
src/lib/libm/src: s_sincos.c

Log Message:
s_sincos.c: use correct order of __weak_alias() arguments...


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/lib/libm/src/s_sincos.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_sincos.c
diff -u src/lib/libm/src/s_sincos.c:1.3 src/lib/libm/src/s_sincos.c:1.4
--- src/lib/libm/src/s_sincos.c:1.3	Sun Aug 28 14:30:41 2022
+++ src/lib/libm/src/s_sincos.c	Sun Aug 28 16:07:58 2022
@@ -14,7 +14,7 @@
 
 #include 
 #if defined(LIBM_SCCS) && !defined(lint)
-__RCSID("$NetBSD: s_sincos.c,v 1.3 2022/08/28 14:30:41 he Exp $");
+__RCSID("$NetBSD: s_sincos.c,v 1.4 2022/08/28 16:07:58 he Exp $");
 #endif
 #if 0
 __FBSDID("$FreeBSD: head/lib/msun/src/s_sincos.c 319047 2017-05-28 06:13:38Z mmel $");
@@ -86,5 +86,5 @@ sincos(double x, double *sn, double *cs)
 }
 
 #if !defined(__HAVE_LONG_DOUBLE)
-__weak_alias(sincos, sincosl);
+__weak_alias(sincosl, sincos);
 #endif



CVS commit: src/lib/libm/src

2022-08-28 Thread Havard Eidnes
Module Name:src
Committed By:   he
Date:   Sun Aug 28 16:07:58 UTC 2022

Modified Files:
src/lib/libm/src: s_sincos.c

Log Message:
s_sincos.c: use correct order of __weak_alias() arguments...


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/lib/libm/src/s_sincos.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/lib/libm/src

2022-08-28 Thread Havard Eidnes
Module Name:src
Committed By:   he
Date:   Sun Aug 28 14:30:41 UTC 2022

Modified Files:
src/lib/libm/src: s_sincos.c

Log Message:
s_sincos.c: use __weak_alias and not __weak_reference.

Fixes build on NetBSD/macppc, thanks to hint from riastradh@


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/lib/libm/src/s_sincos.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_sincos.c
diff -u src/lib/libm/src/s_sincos.c:1.2 src/lib/libm/src/s_sincos.c:1.3
--- src/lib/libm/src/s_sincos.c:1.2	Sun Aug 28 07:29:04 2022
+++ src/lib/libm/src/s_sincos.c	Sun Aug 28 14:30:41 2022
@@ -14,7 +14,7 @@
 
 #include 
 #if defined(LIBM_SCCS) && !defined(lint)
-__RCSID("$NetBSD: s_sincos.c,v 1.2 2022/08/28 07:29:04 christos Exp $");
+__RCSID("$NetBSD: s_sincos.c,v 1.3 2022/08/28 14:30:41 he Exp $");
 #endif
 #if 0
 __FBSDID("$FreeBSD: head/lib/msun/src/s_sincos.c 319047 2017-05-28 06:13:38Z mmel $");
@@ -86,5 +86,5 @@ sincos(double x, double *sn, double *cs)
 }
 
 #if !defined(__HAVE_LONG_DOUBLE)
-__weak_reference(sincos, sincosl);
+__weak_alias(sincos, sincosl);
 #endif



CVS commit: src/lib/libm/src

2022-08-28 Thread Havard Eidnes
Module Name:src
Committed By:   he
Date:   Sun Aug 28 14:30:41 UTC 2022

Modified Files:
src/lib/libm/src: s_sincos.c

Log Message:
s_sincos.c: use __weak_alias and not __weak_reference.

Fixes build on NetBSD/macppc, thanks to hint from riastradh@


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/lib/libm/src/s_sincos.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/lib/libm/src

2022-08-28 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Aug 28 07:29:05 UTC 2022

Modified Files:
src/lib/libm/src: s_sincos.c

Log Message:
only alias sincos to sincosl when we don't have long doubles


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/lib/libm/src/s_sincos.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_sincos.c
diff -u src/lib/libm/src/s_sincos.c:1.1 src/lib/libm/src/s_sincos.c:1.2
--- src/lib/libm/src/s_sincos.c:1.1	Sat Aug 27 04:31:59 2022
+++ src/lib/libm/src/s_sincos.c	Sun Aug 28 03:29:04 2022
@@ -14,7 +14,7 @@
 
 #include 
 #if defined(LIBM_SCCS) && !defined(lint)
-__RCSID("$NetBSD: s_sincos.c,v 1.1 2022/08/27 08:31:59 christos Exp $");
+__RCSID("$NetBSD: s_sincos.c,v 1.2 2022/08/28 07:29:04 christos Exp $");
 #endif
 #if 0
 __FBSDID("$FreeBSD: head/lib/msun/src/s_sincos.c 319047 2017-05-28 06:13:38Z mmel $");
@@ -85,6 +85,6 @@ sincos(double x, double *sn, double *cs)
 	}
 }
 
-#if (LDBL_MANT_DIG == 53)
+#if !defined(__HAVE_LONG_DOUBLE)
 __weak_reference(sincos, sincosl);
 #endif



CVS commit: src/lib/libm/src

2022-08-28 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Aug 28 07:29:05 UTC 2022

Modified Files:
src/lib/libm/src: s_sincos.c

Log Message:
only alias sincos to sincosl when we don't have long doubles


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/lib/libm/src/s_sincos.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/lib/libm/src

2022-08-27 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Aug 27 17:15:52 UTC 2022

Modified Files:
src/lib/libm/src: s_sincosl.c

Log Message:
tuck in k_sincosl.h include inside __HAVE_LONG_DOUBLE


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/lib/libm/src/s_sincosl.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_sincosl.c
diff -u src/lib/libm/src/s_sincosl.c:1.1 src/lib/libm/src/s_sincosl.c:1.2
--- src/lib/libm/src/s_sincosl.c:1.1	Sat Aug 27 04:31:59 2022
+++ src/lib/libm/src/s_sincosl.c	Sat Aug 27 13:15:52 2022
@@ -31,7 +31,7 @@
 __FBSDID("$FreeBSD: head/lib/msun/src/s_sincosl.c 319047 2017-05-28 06:13:38Z mmel $");
 #endif
 #if defined(LIBM_SCCS) && !defined(lint)
-__RCSID("$NetBSD: s_sincosl.c,v 1.1 2022/08/27 08:31:59 christos Exp $");
+__RCSID("$NetBSD: s_sincosl.c,v 1.2 2022/08/27 17:15:52 christos Exp $");
 #endif
 
 #include "namespace.h"
@@ -42,9 +42,11 @@ __RCSID("$NetBSD: s_sincosl.c,v 1.1 2022
 
 #include "math.h"
 #include "math_private.h"
-#include "k_sincosl.h"
 
 #ifdef __HAVE_LONG_DOUBLE
+
+#include "k_sincosl.h"
+
 #if LDBL_MANT_DIG == 64
 #include "../ld80/e_rem_pio2l.h"
 #elif LDBL_MANT_DIG == 113



CVS commit: src/lib/libm/src

2022-08-27 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Aug 27 17:15:52 UTC 2022

Modified Files:
src/lib/libm/src: s_sincosl.c

Log Message:
tuck in k_sincosl.h include inside __HAVE_LONG_DOUBLE


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/lib/libm/src/s_sincosl.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/lib/libm/src

2022-08-24 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Aug 24 13:51:19 UTC 2022

Modified Files:
src/lib/libm/src: e_rem_pio2.c k_rem_pio2.c math_private.h

Log Message:
sync with FreeBSD; bring some more inline functions.


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/lib/libm/src/e_rem_pio2.c
cvs rdiff -u -r1.13 -r1.14 src/lib/libm/src/k_rem_pio2.c
cvs rdiff -u -r1.24 -r1.25 src/lib/libm/src/math_private.h

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_rem_pio2.c
diff -u src/lib/libm/src/e_rem_pio2.c:1.11 src/lib/libm/src/e_rem_pio2.c:1.12
--- src/lib/libm/src/e_rem_pio2.c:1.11	Sun May 26 18:01:52 2002
+++ src/lib/libm/src/e_rem_pio2.c	Wed Aug 24 09:51:19 2022
@@ -12,7 +12,7 @@
 
 #include 
 #if defined(LIBM_SCCS) && !defined(lint)
-__RCSID("$NetBSD: e_rem_pio2.c,v 1.11 2002/05/26 22:01:52 wiz Exp $");
+__RCSID("$NetBSD: e_rem_pio2.c,v 1.12 2022/08/24 13:51:19 christos Exp $");
 #endif
 
 /* __ieee754_rem_pio2(x,y)
@@ -24,23 +24,6 @@ __RCSID("$NetBSD: e_rem_pio2.c,v 1.11 20
 #include "math.h"
 #include "math_private.h"
 
-/*
- * Table of constants for 2/pi, 396 Hex digits (476 decimal) of 2/pi
- */
-static const int32_t two_over_pi[] = {
-0xA2F983, 0x6E4E44, 0x1529FC, 0x2757D1, 0xF534DD, 0xC0DB62,
-0x95993C, 0x439041, 0xFE5163, 0xABDEBB, 0xC561B7, 0x246E3A,
-0x424DD2, 0xE00649, 0x2EEA09, 0xD1921C, 0xFE1DEB, 0x1CB129,
-0xA73EE8, 0x8235F5, 0x2EBB44, 0x84E99C, 0x7026B4, 0x5F7E41,
-0x3991D6, 0x398353, 0x39F49C, 0x845F8B, 0xBDF928, 0x3B1FF8,
-0x97FFDE, 0x05980F, 0xEF2F11, 0x8B5A0A, 0x6D1F6D, 0x367ECF,
-0x27CB09, 0xB74F46, 0x3F669E, 0x5FEA2D, 0x7527BA, 0xC7EBE5,
-0xF17B3D, 0x0739F7, 0x8A5292, 0xEA6BFB, 0x5FB11F, 0x8D5D08,
-0x560330, 0x46FC7B, 0x6BABF0, 0xCFBC20, 0x9AF436, 0x1DA9E3,
-0x91615E, 0xE61B08, 0x659985, 0x5F14A0, 0x68408D, 0xFFD880,
-0x4D7327, 0x310606, 0x1556CA, 0x73A8C9, 0x60E27B, 0xC08C6B,
-};
-
 static const int32_t npio2_hw[] = {
 0x3FF921FB, 0x400921FB, 0x4012D97C, 0x401921FB, 0x401F6A7A, 0x4022D97C,
 0x4025FDBB, 0x402921FB, 0x402C463A, 0x402F6A7A, 0x4031475C, 0x4032D97C,
@@ -163,7 +146,7 @@ __ieee754_rem_pio2(double x, double *y)
 	tx[2] = z;
 	nx = 3;
 	while(tx[nx-1]==zero) nx--;	/* skip zero term */
-	n  =  __kernel_rem_pio2(tx,y,e0,nx,2,two_over_pi);
+	n  =  __kernel_rem_pio2(tx,y,e0,nx,2);
 	if(hx<0) {y[0] = -y[0]; y[1] = -y[1]; return -n;}
 	return n;
 }

Index: src/lib/libm/src/k_rem_pio2.c
diff -u src/lib/libm/src/k_rem_pio2.c:1.13 src/lib/libm/src/k_rem_pio2.c:1.14
--- src/lib/libm/src/k_rem_pio2.c:1.13	Thu Jun 22 08:43:43 2017
+++ src/lib/libm/src/k_rem_pio2.c	Wed Aug 24 09:51:19 2022
@@ -1,9 +1,10 @@
-/* @(#)k_rem_pio2.c 5.1 93/09/24 */
+
+/* @(#)k_rem_pio2.c 1.3 95/01/18 */
 /*
  * 
  * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
  *
- * Developed at SunPro, a Sun Microsystems, Inc. business.
+ * Developed at SunSoft, a Sun Microsystems, Inc. business.
  * Permission to use, copy, modify, and distribute this
  * software is freely granted, provided that this notice
  * is preserved.
@@ -11,13 +12,16 @@
  */
 
 #include 
+#if 0
+__FBSDID("$FreeBSD: head/lib/msun/src/k_rem_pio2.c 342651 2018-12-31 15:43:06Z pfg $");
+#endif
 #if defined(LIBM_SCCS) && !defined(lint)
-__RCSID("$NetBSD: k_rem_pio2.c,v 1.13 2017/06/22 12:43:43 maya Exp $");
+__RCSID("$NetBSD: k_rem_pio2.c,v 1.14 2022/08/24 13:51:19 christos Exp $");
 #endif
 
 /*
- * __kernel_rem_pio2(x,y,e0,nx,prec,ipio2)
- * double x[],y[]; int e0,nx,prec; int ipio2[];
+ * __kernel_rem_pio2(x,y,e0,nx,prec)
+ * double x[],y[]; int e0,nx,prec;
  *
  * __kernel_rem_pio2 return the last three digits of N with
  *		y = x - N*pi/2
@@ -53,7 +57,7 @@ __RCSID("$NetBSD: k_rem_pio2.c,v 1.13 20
  *			64-bit  precision	2
  *			113-bit precision	3
  *		The actual value is the sum of them. Thus for 113-bit
- *		precison, one may have to do something like:
+ *		precision, one may have to do something like:
  *
  *		long double t,w,r_head, r_tail;
  *		t = (long double)y[2] + (long double)y[1];
@@ -61,7 +65,8 @@ __RCSID("$NetBSD: k_rem_pio2.c,v 1.13 20
  *		r_head = t+w;
  *		r_tail = w - (r_head - t);
  *
- *	e0	The exponent of x[0]
+ *	e0	The exponent of x[0]. Must be <= 16360 or you need to
+ *  expand the ipio2 table.
  *
  *	nx	dimension of x[]
  *
@@ -71,13 +76,6 @@ __RCSID("$NetBSD: k_rem_pio2.c,v 1.13 20
  *			2	64  bits (extended)
  *			3	113 bits (quad)
  *
- *	ipio2[]
- *		integer array, contains the (24*i)-th to (24*i+23)-th
- *		bit of 2/pi after binary point. The corresponding
- *		floating value is
- *
- *			ipio2[i] * 2^(-24(i+1)).
- *
  * External function:
  *	double scalbn(), floor();
  *
@@ -85,8 +83,13 @@ __RCSID("$NetBSD: k_rem_pio2.c,v 1.13 20
  * Here is the description of some local variables:
  *
  * 	jk	jk+1 is the initial number of terms of ipio2[] needed
- *		in the computation. The recommended 

CVS commit: src/lib/libm/src

2022-08-24 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Aug 24 13:51:19 UTC 2022

Modified Files:
src/lib/libm/src: e_rem_pio2.c k_rem_pio2.c math_private.h

Log Message:
sync with FreeBSD; bring some more inline functions.


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/lib/libm/src/e_rem_pio2.c
cvs rdiff -u -r1.13 -r1.14 src/lib/libm/src/k_rem_pio2.c
cvs rdiff -u -r1.24 -r1.25 src/lib/libm/src/math_private.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/lib/libm/src

2021-12-04 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Sun Dec  5 04:22:50 UTC 2021

Modified Files:
src/lib/libm/src: s_fabsl.c

Log Message:
s/argumetn/argument/ in comment.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/lib/libm/src/s_fabsl.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_fabsl.c
diff -u src/lib/libm/src/s_fabsl.c:1.3 src/lib/libm/src/s_fabsl.c:1.4
--- src/lib/libm/src/s_fabsl.c:1.3	Fri Nov 29 22:16:10 2013
+++ src/lib/libm/src/s_fabsl.c	Sun Dec  5 04:22:50 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: s_fabsl.c,v 1.3 2013/11/29 22:16:10 joerg Exp $	*/
+/*	$NetBSD: s_fabsl.c,v 1.4 2021/12/05 04:22:50 msaitoh Exp $	*/
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -26,14 +26,14 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include 
-__RCSID("$NetBSD: s_fabsl.c,v 1.3 2013/11/29 22:16:10 joerg Exp $");
+__RCSID("$NetBSD: s_fabsl.c,v 1.4 2021/12/05 04:22:50 msaitoh Exp $");
 
 #include 
 #include 
 
 /*
  * fabsl(long double x)
- * This function returns the absolute value of its argumetn x, |x|.
+ * This function returns the absolute value of its argument x, |x|.
  */
 #ifdef __HAVE_LONG_DOUBLE
 long double



CVS commit: src/lib/libm/src

2021-12-04 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Sun Dec  5 04:22:50 UTC 2021

Modified Files:
src/lib/libm/src: s_fabsl.c

Log Message:
s/argumetn/argument/ in comment.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/lib/libm/src/s_fabsl.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/lib/libm/src

2021-04-12 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Mon Apr 12 09:15:52 UTC 2021

Modified Files:
src/lib/libm/src: k_standard.c

Log Message:
add a default: case to __kernel_standard(), failing with EDOM


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 src/lib/libm/src/k_standard.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/k_standard.c
diff -u src/lib/libm/src/k_standard.c:1.22 src/lib/libm/src/k_standard.c:1.23
--- src/lib/libm/src/k_standard.c:1.22	Sat Aug 27 10:03:16 2016
+++ src/lib/libm/src/k_standard.c	Mon Apr 12 09:15:52 2021
@@ -12,7 +12,7 @@
 
 #include 
 #if defined(LIBM_SCCS) && !defined(lint)
-__RCSID("$NetBSD: k_standard.c,v 1.22 2016/08/27 10:03:16 christos Exp $");
+__RCSID("$NetBSD: k_standard.c,v 1.23 2021/04/12 09:15:52 mrg Exp $");
 #endif
 
 #include "math.h"
@@ -825,6 +825,13 @@ __kernel_standard(double x, double y, in
 		  errno = EDOM;
 		}
 		break;
+	default:
+		if (_LIB_VERSION == _SVID_)
+		  exc.retval = -HUGE;
+		else
+		  exc.retval = -HUGE_VAL;
+		errno = EDOM;
+		break;
 	}
 	return exc.retval;
 }



CVS commit: src/lib/libm/src

2021-04-12 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Mon Apr 12 09:15:52 UTC 2021

Modified Files:
src/lib/libm/src: k_standard.c

Log Message:
add a default: case to __kernel_standard(), failing with EDOM


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 src/lib/libm/src/k_standard.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/lib/libm/src

2020-01-30 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Thu Jan 30 20:31:50 UTC 2020

Modified Files:
src/lib/libm/src: s_frexp.c

Log Message:
Provide frexpl on non-long-double systems as alias to frexp.


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/lib/libm/src/s_frexp.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_frexp.c
diff -u src/lib/libm/src/s_frexp.c:1.13 src/lib/libm/src/s_frexp.c:1.14
--- src/lib/libm/src/s_frexp.c:1.13	Sun Sep 28 18:54:55 2008
+++ src/lib/libm/src/s_frexp.c	Thu Jan 30 20:31:50 2020
@@ -12,7 +12,7 @@
 
 #include 
 #if defined(LIBM_SCCS) && !defined(lint)
-__RCSID("$NetBSD: s_frexp.c,v 1.13 2008/09/28 18:54:55 christos Exp $");
+__RCSID("$NetBSD: s_frexp.c,v 1.14 2020/01/30 20:31:50 joerg Exp $");
 #endif
 
 /*
@@ -28,6 +28,10 @@ __RCSID("$NetBSD: s_frexp.c,v 1.13 2008/
 #include "math.h"
 #include "math_private.h"
 
+#ifndef __HAVE_LONG_DOUBLE
+__strong_alias(frexpl, frexp)
+#endif
+
 static const double
 two54 =  1.8014398509481984e+16; /* 0x4350, 0x */
 



CVS commit: src/lib/libm/src

2020-01-30 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Thu Jan 30 20:31:50 UTC 2020

Modified Files:
src/lib/libm/src: s_frexp.c

Log Message:
Provide frexpl on non-long-double systems as alias to frexp.


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/lib/libm/src/s_frexp.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/lib/libm/src

2018-03-27 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Mar 27 11:59:49 UTC 2018

Modified Files:
src/lib/libm/src: s_scalbn.c

Log Message:
Add missing alias for ldexpl on ! __HAVE_LONG_DOUBLE architectures.
Pointed out by Hal Murray on port-arm.


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/lib/libm/src/s_scalbn.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_scalbn.c
diff -u src/lib/libm/src/s_scalbn.c:1.18 src/lib/libm/src/s_scalbn.c:1.19
--- src/lib/libm/src/s_scalbn.c:1.18	Mon May 20 19:40:09 2013
+++ src/lib/libm/src/s_scalbn.c	Tue Mar 27 11:59:49 2018
@@ -12,7 +12,7 @@
 
 #include 
 #if defined(LIBM_SCCS) && !defined(lint)
-__RCSID("$NetBSD: s_scalbn.c,v 1.18 2013/05/20 19:40:09 joerg Exp $");
+__RCSID("$NetBSD: s_scalbn.c,v 1.19 2018/03/27 11:59:49 martin Exp $");
 #endif
 
 /*
@@ -35,6 +35,7 @@ __strong_alias(_scalbnl, _scalbn)
 __strong_alias(_scalblnl, _scalbln)
 __weak_alias(scalbnl, _scalbnl)
 __weak_alias(scalblnl, _scalblnl)
+__weak_alias(ldexpl, _scalblnl)
 #endif
 
 #ifdef __weak_alias



CVS commit: src/lib/libm/src

2018-03-27 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Mar 27 11:59:49 UTC 2018

Modified Files:
src/lib/libm/src: s_scalbn.c

Log Message:
Add missing alias for ldexpl on ! __HAVE_LONG_DOUBLE architectures.
Pointed out by Hal Murray on port-arm.


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/lib/libm/src/s_scalbn.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/lib/libm/src

2018-03-10 Thread Eitan Adler
Module Name:src
Committed By:   eadler
Date:   Sat Mar 10 09:44:47 UTC 2018

Modified Files:
src/lib/libm/src: e_atan2.c

Log Message:
Fix signed overflow in atan2

As a component of atan2(y, x), the case of x == 1.0 is farmed out to
atan(y). The current implementation of this comparison is vulnerable
to signed integer underflow (that is, undefined behavior), and it's
performed in a somewhat more complicated way than it need be. Change
it to not be quite so cute, rather directly comparing the high/low
bits of x to the specific IEEE-754 bit pattern that encodes 1.0.

ok martin@ pgoyette@ maya@
obtained from FreeBSD


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/lib/libm/src/e_atan2.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/lib/libm/src

2018-03-10 Thread Eitan Adler
Module Name:src
Committed By:   eadler
Date:   Sat Mar 10 09:44:47 UTC 2018

Modified Files:
src/lib/libm/src: e_atan2.c

Log Message:
Fix signed overflow in atan2

As a component of atan2(y, x), the case of x == 1.0 is farmed out to
atan(y). The current implementation of this comparison is vulnerable
to signed integer underflow (that is, undefined behavior), and it's
performed in a somewhat more complicated way than it need be. Change
it to not be quite so cute, rather directly comparing the high/low
bits of x to the specific IEEE-754 bit pattern that encodes 1.0.

ok martin@ pgoyette@ maya@
obtained from FreeBSD


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/lib/libm/src/e_atan2.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_atan2.c
diff -u src/lib/libm/src/e_atan2.c:1.12 src/lib/libm/src/e_atan2.c:1.13
--- src/lib/libm/src/e_atan2.c:1.12	Sun May 26 22:01:48 2002
+++ src/lib/libm/src/e_atan2.c	Sat Mar 10 09:44:47 2018
@@ -12,7 +12,7 @@
 
 #include 
 #if defined(LIBM_SCCS) && !defined(lint)
-__RCSID("$NetBSD: e_atan2.c,v 1.12 2002/05/26 22:01:48 wiz Exp $");
+__RCSID("$NetBSD: e_atan2.c,v 1.13 2018/03/10 09:44:47 eadler Exp $");
 #endif
 
 /* __ieee754_atan2(y,x)
@@ -67,7 +67,7 @@ __ieee754_atan2(double y, double x)
 	if(((ix|((lx|-lx)>>31))>0x7ff0)||
 	   ((iy|((ly|-ly)>>31))>0x7ff0))	/* x or y is NaN */
 	   return x+y;
-	if(((hx-0x3ff0)|lx)==0) return atan(y);   /* x=1.0 */
+	if(hx==0x3ff0&==0) return atan(y);   /* x=1.0 */
 	m = ((hy>>31)&1)|((hx>>30)&2);	/* 2*sign(x)+sign(y) */
 
 /* when y = 0 */



CVS commit: src/lib/libm/src

2017-08-16 Thread Havard Eidnes
Module Name:src
Committed By:   he
Date:   Wed Aug 16 11:22:52 UTC 2017

Modified Files:
src/lib/libm/src: s_nextafter.c

Log Message:
On second thought, don't introduce nexttowardl() since we don't have that
yet elsewhere.


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/lib/libm/src/s_nextafter.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/lib/libm/src

2017-08-16 Thread Havard Eidnes
Module Name:src
Committed By:   he
Date:   Wed Aug 16 11:22:52 UTC 2017

Modified Files:
src/lib/libm/src: s_nextafter.c

Log Message:
On second thought, don't introduce nexttowardl() since we don't have that
yet elsewhere.


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/lib/libm/src/s_nextafter.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.15 src/lib/libm/src/s_nextafter.c:1.16
--- src/lib/libm/src/s_nextafter.c:1.15	Wed Aug 16 09:15:48 2017
+++ src/lib/libm/src/s_nextafter.c	Wed Aug 16 11:22:52 2017
@@ -12,7 +12,7 @@
 
 #include 
 #if defined(LIBM_SCCS) && !defined(lint)
-__RCSID("$NetBSD: s_nextafter.c,v 1.15 2017/08/16 09:15:48 he Exp $");
+__RCSID("$NetBSD: s_nextafter.c,v 1.16 2017/08/16 11:22:52 he Exp $");
 #endif
 
 /* IEEE functions
@@ -28,7 +28,6 @@ __RCSID("$NetBSD: s_nextafter.c,v 1.15 2
 #ifndef __HAVE_LONG_DOUBLE
 __strong_alias(nextafterl, nextafter)
 __strong_alias(nexttoward, nextafter)
-__strong_alias(nexttowardl, nextafter)
 #endif
 
 double



CVS commit: src/lib/libm/src

2017-08-16 Thread Havard Eidnes
Module Name:src
Committed By:   he
Date:   Wed Aug 16 09:15:49 UTC 2017

Modified Files:
src/lib/libm/src: s_nextafter.c

Log Message:
On systems without __HAVE_LONG_DOUBLE, also alias nexttoward() and
nexttowardl() to nextafter().


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/lib/libm/src/s_nextafter.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/lib/libm/src

2017-08-16 Thread Havard Eidnes
Module Name:src
Committed By:   he
Date:   Wed Aug 16 09:15:49 UTC 2017

Modified Files:
src/lib/libm/src: s_nextafter.c

Log Message:
On systems without __HAVE_LONG_DOUBLE, also alias nexttoward() and
nexttowardl() to nextafter().


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/lib/libm/src/s_nextafter.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.14 src/lib/libm/src/s_nextafter.c:1.15
--- src/lib/libm/src/s_nextafter.c:1.14	Tue Mar 18 18:20:37 2014
+++ src/lib/libm/src/s_nextafter.c	Wed Aug 16 09:15:48 2017
@@ -12,7 +12,7 @@
 
 #include 
 #if defined(LIBM_SCCS) && !defined(lint)
-__RCSID("$NetBSD: s_nextafter.c,v 1.14 2014/03/18 18:20:37 riastradh Exp $");
+__RCSID("$NetBSD: s_nextafter.c,v 1.15 2017/08/16 09:15:48 he Exp $");
 #endif
 
 /* IEEE functions
@@ -27,6 +27,8 @@ __RCSID("$NetBSD: s_nextafter.c,v 1.14 2
 
 #ifndef __HAVE_LONG_DOUBLE
 __strong_alias(nextafterl, nextafter)
+__strong_alias(nexttoward, nextafter)
+__strong_alias(nexttowardl, nextafter)
 #endif
 
 double



CVS commit: src/lib/libm/src

2017-06-22 Thread Maya Rashish
Module Name:src
Committed By:   maya
Date:   Thu Jun 22 12:43:43 UTC 2017

Modified Files:
src/lib/libm/src: k_rem_pio2.c k_rem_pio2f.c

Log Message:
Correct misleading indentation. NFC

>From GCC8


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/lib/libm/src/k_rem_pio2.c
cvs rdiff -u -r1.8 -r1.9 src/lib/libm/src/k_rem_pio2f.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/k_rem_pio2.c
diff -u src/lib/libm/src/k_rem_pio2.c:1.12 src/lib/libm/src/k_rem_pio2.c:1.13
--- src/lib/libm/src/k_rem_pio2.c:1.12	Fri Apr 23 19:17:07 2010
+++ src/lib/libm/src/k_rem_pio2.c	Thu Jun 22 12:43:43 2017
@@ -12,7 +12,7 @@
 
 #include 
 #if defined(LIBM_SCCS) && !defined(lint)
-__RCSID("$NetBSD: k_rem_pio2.c,v 1.12 2010/04/23 19:17:07 drochner Exp $");
+__RCSID("$NetBSD: k_rem_pio2.c,v 1.13 2017/06/22 12:43:43 maya Exp $");
 #endif
 
 /*
@@ -175,7 +175,9 @@ __kernel_rem_pio2(double *x, double *y, 
 
 /* compute q[0],q[1],...q[jk] */
 	for (i=0;i<=jk;i++) {
-	for(j=0,fw=0.0;j<=jx;j++) fw += x[j]*f[jx+i-j]; q[i] = fw;
+	for(j=0,fw=0.0;j<=jx;j++)
+		fw += x[j]*f[jx+i-j];
+	q[i] = fw;
 	}
 
 	jz = jk;

Index: src/lib/libm/src/k_rem_pio2f.c
diff -u src/lib/libm/src/k_rem_pio2f.c:1.8 src/lib/libm/src/k_rem_pio2f.c:1.9
--- src/lib/libm/src/k_rem_pio2f.c:1.8	Fri Apr 23 19:17:07 2010
+++ src/lib/libm/src/k_rem_pio2f.c	Thu Jun 22 12:43:43 2017
@@ -15,7 +15,7 @@
 
 #include 
 #if defined(LIBM_SCCS) && !defined(lint)
-__RCSID("$NetBSD: k_rem_pio2f.c,v 1.8 2010/04/23 19:17:07 drochner Exp $");
+__RCSID("$NetBSD: k_rem_pio2f.c,v 1.9 2017/06/22 12:43:43 maya Exp $");
 #endif
 
 #include "namespace.h"
@@ -68,7 +68,9 @@ __kernel_rem_pio2f(float *x, float *y, i
 
 /* compute q[0],q[1],...q[jk] */
 	for (i=0;i<=jk;i++) {
-	for(j=0,fw=0.0;j<=jx;j++) fw += x[j]*f[jx+i-j]; q[i] = fw;
+	for(j=0,fw=0.0;j<=jx;j++)
+		fw += x[j]*f[jx+i-j];
+	q[i] = fw;
 	}
 
 	jz = jk;



CVS commit: src/lib/libm/src

2017-06-22 Thread Maya Rashish
Module Name:src
Committed By:   maya
Date:   Thu Jun 22 12:43:43 UTC 2017

Modified Files:
src/lib/libm/src: k_rem_pio2.c k_rem_pio2f.c

Log Message:
Correct misleading indentation. NFC

>From GCC8


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/lib/libm/src/k_rem_pio2.c
cvs rdiff -u -r1.8 -r1.9 src/lib/libm/src/k_rem_pio2f.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/lib/libm/src

2017-05-08 Thread Maya Rashish
Module Name:src
Committed By:   maya
Date:   Tue May  9 02:04:38 UTC 2017

Modified Files:
src/lib/libm/src: e_asin.c e_asinf.c

Log Message:
Correct misleading indentation. NFC

This isn't a functional difference because huge + x > one is
always true for a small x, and is probably a magical incantation
to raise inexact if x != 0

Found by GCC 8.0


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/lib/libm/src/e_asin.c
cvs rdiff -u -r1.8 -r1.9 src/lib/libm/src/e_asinf.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_asin.c
diff -u src/lib/libm/src/e_asin.c:1.12 src/lib/libm/src/e_asin.c:1.13
--- src/lib/libm/src/e_asin.c:1.12	Sun May 26 22:01:48 2002
+++ src/lib/libm/src/e_asin.c	Tue May  9 02:04:38 2017
@@ -12,7 +12,7 @@
 
 #include 
 #if defined(LIBM_SCCS) && !defined(lint)
-__RCSID("$NetBSD: e_asin.c,v 1.12 2002/05/26 22:01:48 wiz Exp $");
+__RCSID("$NetBSD: e_asin.c,v 1.13 2017/05/09 02:04:38 maya Exp $");
 #endif
 
 /* __ieee754_asin(x)
@@ -86,12 +86,13 @@ __ieee754_asin(double x)
 	} else if (ix<0x3fe0) {	/* |x|<0.5 */
 	if(ix<0x3e40) {		/* if |x| < 2**-27 */
 		if(huge+x>one) return x;/* return x with inexact if x!=0*/
-	} else
+	} else {
 		t = x*x;
 		p = t*(pS0+t*(pS1+t*(pS2+t*(pS3+t*(pS4+t*pS5);
 		q = one+t*(qS1+t*(qS2+t*(qS3+t*qS4)));
 		w = p/q;
 		return x+x*w;
+	}
 	}
 	/* 1> |x|>= 0.5 */
 	w = one-fabs(x);

Index: src/lib/libm/src/e_asinf.c
diff -u src/lib/libm/src/e_asinf.c:1.8 src/lib/libm/src/e_asinf.c:1.9
--- src/lib/libm/src/e_asinf.c:1.8	Sun May 26 22:01:48 2002
+++ src/lib/libm/src/e_asinf.c	Tue May  9 02:04:38 2017
@@ -15,7 +15,7 @@
 
 #include 
 #if defined(LIBM_SCCS) && !defined(lint)
-__RCSID("$NetBSD: e_asinf.c,v 1.8 2002/05/26 22:01:48 wiz Exp $");
+__RCSID("$NetBSD: e_asinf.c,v 1.9 2017/05/09 02:04:38 maya Exp $");
 #endif
 
 #include "math.h"
@@ -56,12 +56,13 @@ __ieee754_asinf(float x)
 	} else if (ix<0x3f00) {	/* |x|<0.5 */
 	if(ix<0x3200) {		/* if |x| < 2**-27 */
 		if(huge+x>one) return x;/* return x with inexact if x!=0*/
-	} else
+	} else {
 		t = x*x;
 		p = t*(pS0+t*(pS1+t*(pS2+t*(pS3+t*(pS4+t*pS5);
 		q = one+t*(qS1+t*(qS2+t*(qS3+t*qS4)));
 		w = p/q;
 		return x+x*w;
+	}
 	}
 	/* 1> |x|>= 0.5 */
 	w = one-fabsf(x);



CVS commit: src/lib/libm/src

2017-05-08 Thread Maya Rashish
Module Name:src
Committed By:   maya
Date:   Tue May  9 02:04:38 UTC 2017

Modified Files:
src/lib/libm/src: e_asin.c e_asinf.c

Log Message:
Correct misleading indentation. NFC

This isn't a functional difference because huge + x > one is
always true for a small x, and is probably a magical incantation
to raise inexact if x != 0

Found by GCC 8.0


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/lib/libm/src/e_asin.c
cvs rdiff -u -r1.8 -r1.9 src/lib/libm/src/e_asinf.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/lib/libm/src

2017-05-07 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun May  7 11:29:21 UTC 2017

Modified Files:
src/lib/libm/src: s_llrintl.c s_lrintl.c

Log Message:
Limit some rintl usage to #ifdef __HAVE_LONG_DOUBLE.
XXX should probably declare some aliases in the #else case


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/lib/libm/src/s_llrintl.c \
src/lib/libm/src/s_lrintl.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_llrintl.c
diff -u src/lib/libm/src/s_llrintl.c:1.1 src/lib/libm/src/s_llrintl.c:1.2
--- src/lib/libm/src/s_llrintl.c:1.1	Sat May  6 18:03:24 2017
+++ src/lib/libm/src/s_llrintl.c	Sun May  7 11:29:21 2017
@@ -2,12 +2,15 @@
 #ifdef __FreeBSD__
 __FBSDID("$FreeBSD: head/lib/msun/src/s_llrintl.c 175309 2008-01-14 02:12:07Z das $");
 #else
-__RCSID("$NetBSD: s_llrintl.c,v 1.1 2017/05/06 18:03:24 christos Exp $");
+__RCSID("$NetBSD: s_llrintl.c,v 1.2 2017/05/07 11:29:21 martin Exp $");
 #endif
 
+#ifdef __HAVE_LONG_DOUBLE
 #define stype		long double
 #define	roundit		rintl
 #define dtype		long long
 #define	fn		llrintl
 
 #include "s_lrint.c"
+#endif
+
Index: src/lib/libm/src/s_lrintl.c
diff -u src/lib/libm/src/s_lrintl.c:1.1 src/lib/libm/src/s_lrintl.c:1.2
--- src/lib/libm/src/s_lrintl.c:1.1	Sat May  6 18:03:24 2017
+++ src/lib/libm/src/s_lrintl.c	Sun May  7 11:29:21 2017
@@ -2,12 +2,14 @@
 #ifdef __FreeBSD__
 __FBSDID("$FreeBSD: head/lib/msun/src/s_lrintl.c 175309 2008-01-14 02:12:07Z das $");
 #else
-__RCSID("$NetBSD: s_lrintl.c,v 1.1 2017/05/06 18:03:24 christos Exp $");
+__RCSID("$NetBSD: s_lrintl.c,v 1.2 2017/05/07 11:29:21 martin Exp $");
 #endif
 
+#ifdef __HAVE_LONG_DOUBLE
 #define stype		long double
 #define	roundit		rintl
 #define dtype		long
 #define	fn		lrintl
 
 #include "s_lrint.c"
+#endif



CVS commit: src/lib/libm/src

2017-05-07 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun May  7 11:29:21 UTC 2017

Modified Files:
src/lib/libm/src: s_llrintl.c s_lrintl.c

Log Message:
Limit some rintl usage to #ifdef __HAVE_LONG_DOUBLE.
XXX should probably declare some aliases in the #else case


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/lib/libm/src/s_llrintl.c \
src/lib/libm/src/s_lrintl.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/lib/libm/src

2017-05-06 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat May  6 18:02:52 UTC 2017

Modified Files:
src/lib/libm/src: e_sqrtl.c s_fma.c s_fmaf.c s_fmal.c s_nearbyint.c

Log Message:
add missing namespace.h


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/lib/libm/src/e_sqrtl.c
cvs rdiff -u -r1.6 -r1.7 src/lib/libm/src/s_fma.c
cvs rdiff -u -r1.2 -r1.3 src/lib/libm/src/s_fmaf.c
cvs rdiff -u -r1.3 -r1.4 src/lib/libm/src/s_fmal.c \
src/lib/libm/src/s_nearbyint.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/lib/libm/src

2017-05-06 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat May  6 18:02:52 UTC 2017

Modified Files:
src/lib/libm/src: e_sqrtl.c s_fma.c s_fmaf.c s_fmal.c s_nearbyint.c

Log Message:
add missing namespace.h


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/lib/libm/src/e_sqrtl.c
cvs rdiff -u -r1.6 -r1.7 src/lib/libm/src/s_fma.c
cvs rdiff -u -r1.2 -r1.3 src/lib/libm/src/s_fmaf.c
cvs rdiff -u -r1.3 -r1.4 src/lib/libm/src/s_fmal.c \
src/lib/libm/src/s_nearbyint.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_sqrtl.c
diff -u src/lib/libm/src/e_sqrtl.c:1.5 src/lib/libm/src/e_sqrtl.c:1.6
--- src/lib/libm/src/e_sqrtl.c:1.5	Fri Aug 26 04:31:17 2016
+++ src/lib/libm/src/e_sqrtl.c	Sat May  6 14:02:52 2017
@@ -28,8 +28,9 @@
 #if 0
 __FBSDID("$FreeBSD: head/lib/msun/src/e_sqrtl.c 176720 2008-03-02 01:47:58Z das $");
 #endif
-__RCSID("$NetBSD: e_sqrtl.c,v 1.5 2016/08/26 08:31:17 christos Exp $");
+__RCSID("$NetBSD: e_sqrtl.c,v 1.6 2017/05/06 18:02:52 christos Exp $");
 
+#include "namespace.h"
 #include 
 #include 
 

Index: src/lib/libm/src/s_fma.c
diff -u src/lib/libm/src/s_fma.c:1.6 src/lib/libm/src/s_fma.c:1.7
--- src/lib/libm/src/s_fma.c:1.6	Thu Feb 14 04:24:50 2013
+++ src/lib/libm/src/s_fma.c	Sat May  6 14:02:52 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: s_fma.c,v 1.6 2013/02/14 09:24:50 matt Exp $	*/
+/*	$NetBSD: s_fma.c,v 1.7 2017/05/06 18:02:52 christos Exp $	*/
 
 /*-
  * Copyright (c) 2005-2011 David Schultz 
@@ -30,9 +30,11 @@
 #if 0
 __FBSDID("$FreeBSD: src/lib/msun/src/s_fma.c,v 1.8 2011/10/21 06:30:43 das Exp $");
 #else
-__RCSID("$NetBSD: s_fma.c,v 1.6 2013/02/14 09:24:50 matt Exp $");
+__RCSID("$NetBSD: s_fma.c,v 1.7 2017/05/06 18:02:52 christos Exp $");
 #endif
 
+#include "namespace.h"
+
 #include 
 #include 
 #include 

Index: src/lib/libm/src/s_fmaf.c
diff -u src/lib/libm/src/s_fmaf.c:1.2 src/lib/libm/src/s_fmaf.c:1.3
--- src/lib/libm/src/s_fmaf.c:1.2	Sun Feb 10 20:29:58 2013
+++ src/lib/libm/src/s_fmaf.c	Sat May  6 14:02:52 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: s_fmaf.c,v 1.2 2013/02/11 01:29:58 christos Exp $	*/
+/*	$NetBSD: s_fmaf.c,v 1.3 2017/05/06 18:02:52 christos Exp $	*/
 
 /*-
  * Copyright (c) 2005-2011 David Schultz 
@@ -30,9 +30,11 @@
 #if 0
 __FBSDID("$FreeBSD: src/lib/msun/src/s_fmaf.c,v 1.3 2011/10/15 04:16:58 das Exp $");
 #else
-__RCSID("$NetBSD: s_fmaf.c,v 1.2 2013/02/11 01:29:58 christos Exp $");
+__RCSID("$NetBSD: s_fmaf.c,v 1.3 2017/05/06 18:02:52 christos Exp $");
 #endif
 
+#include "namespace.h"
+
 #include 
 
 #include "math.h"

Index: src/lib/libm/src/s_fmal.c
diff -u src/lib/libm/src/s_fmal.c:1.3 src/lib/libm/src/s_fmal.c:1.4
--- src/lib/libm/src/s_fmal.c:1.3	Tue Feb 12 16:40:19 2013
+++ src/lib/libm/src/s_fmal.c	Sat May  6 14:02:52 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: s_fmal.c,v 1.3 2013/02/12 21:40:19 martin Exp $	*/
+/*	$NetBSD: s_fmal.c,v 1.4 2017/05/06 18:02:52 christos Exp $	*/
 
 /*-
  * Copyright (c) 2005-2011 David Schultz 
@@ -30,9 +30,11 @@
 #if 0
 __FBSDID("$FreeBSD: src/lib/msun/src/s_fmal.c,v 1.7 2011/10/21 06:30:43 das Exp $");
 #else
-__RCSID("$NetBSD: s_fmal.c,v 1.3 2013/02/12 21:40:19 martin Exp $");
+__RCSID("$NetBSD: s_fmal.c,v 1.4 2017/05/06 18:02:52 christos Exp $");
 #endif
 
+#include "namespace.h"
+
 #include 
 #include 
 #include 
Index: src/lib/libm/src/s_nearbyint.c
diff -u src/lib/libm/src/s_nearbyint.c:1.3 src/lib/libm/src/s_nearbyint.c:1.4
--- src/lib/libm/src/s_nearbyint.c:1.3	Sun Feb 10 21:45:27 2013
+++ src/lib/libm/src/s_nearbyint.c	Sat May  6 14:02:52 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: s_nearbyint.c,v 1.3 2013/02/11 02:45:27 christos Exp $	*/
+/*	$NetBSD: s_nearbyint.c,v 1.4 2017/05/06 18:02:52 christos Exp $	*/
 
 /*-
  * Copyright (c) 2004 David Schultz 
@@ -30,9 +30,11 @@
 #if 0
 __FBSDID("$FreeBSD: src/lib/msun/src/s_nearbyint.c,v 1.2 2008/01/14 02:12:06 das Exp $");
 #else
-__RCSID("$NetBSD: s_nearbyint.c,v 1.3 2013/02/11 02:45:27 christos Exp $");
+__RCSID("$NetBSD: s_nearbyint.c,v 1.4 2017/05/06 18:02:52 christos Exp $");
 #endif
 
+#include "namespace.h"
+
 #include 
 #include 
 #include 



CVS commit: src/lib/libm/src

2017-02-26 Thread Chuck Silvers
Module Name:src
Committed By:   chs
Date:   Mon Feb 27 06:49:02 UTC 2017

Modified Files:
src/lib/libm/src: lrint.c

Log Message:
the MI lrint() code assumes that rounding is done in at most double precision
but m68k (68881) uses extended precision by default, so put the FPU in
double-precision mode temporarily here.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/lib/libm/src/lrint.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/lrint.c
diff -u src/lib/libm/src/lrint.c:1.5 src/lib/libm/src/lrint.c:1.6
--- src/lib/libm/src/lrint.c:1.5	Thu Jul  9 06:17:13 2015
+++ src/lib/libm/src/lrint.c	Mon Feb 27 06:49:02 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: lrint.c,v 1.5 2015/07/09 06:17:13 nat Exp $ */
+/* $NetBSD: lrint.c,v 1.6 2017/02/27 06:49:02 chs Exp $ */
 
 /*-
  * Copyright (c) 2004
@@ -46,6 +46,15 @@ TWO52[2]={
  -4.5035996273704960e+15, /* 0xC330, 0x */
 };
 
+#ifdef __HAVE_68881__
+#include 
+
+#define get_fpcr(__fpcr) \
+__asm__ __volatile__ ("fmove%.l %!,%0" : "=dm" (__fpcr))
+#define set_fpcr(__fpcr) \
+__asm__ __volatile__ ("fmove%.l %0,%!" : : "dm" (__fpcr))
+#endif
+
 RESTYPE
 LRINTNAME(double x)
 {
@@ -68,8 +77,20 @@ LRINTNAME(double x)
 	/* >= 2^52 is already an exact integer */
 	if (e < DBL_FRACBITS) {
 		/* round, using current direction */
+#ifdef __HAVE_68881__
+		int ofpcr, nfpcr;
+
+		/* For m68k hardfloat, use double-precision */
+		get_fpcr(ofpcr);
+		nfpcr = (ofpcr & ~FPCR_PREC) | FPCR_DBL;
+		set_fpcr(nfpcr);
+#endif
 		x += TWO52[s];
 		x -= TWO52[s];
+#ifdef __HAVE_68881__
+		__asm__ __volatile__ ("/* dummy %0 */" : : "f" (x));
+		set_fpcr(ofpcr);
+#endif
 	} else
 		return x;
 



CVS commit: src/lib/libm/src

2017-02-26 Thread Chuck Silvers
Module Name:src
Committed By:   chs
Date:   Mon Feb 27 06:49:02 UTC 2017

Modified Files:
src/lib/libm/src: lrint.c

Log Message:
the MI lrint() code assumes that rounding is done in at most double precision
but m68k (68881) uses extended precision by default, so put the FPU in
double-precision mode temporarily here.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/lib/libm/src/lrint.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/lib/libm/src

2017-02-09 Thread Maya Rashish
Module Name:src
Committed By:   maya
Date:   Thu Feb  9 22:11:09 UTC 2017

Modified Files:
src/lib/libm/src: s_expm1.c s_expm1f.c

Log Message:
ifdef out some dead code. improves code readability.
all later users of y first assign another value.

using ifdefs to make potential future code syncs easier, as is done
elsewhere.

suggested by coverity, CID 1300929, 1300930.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/lib/libm/src/s_expm1.c
cvs rdiff -u -r1.10 -r1.11 src/lib/libm/src/s_expm1f.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_expm1.c
diff -u src/lib/libm/src/s_expm1.c:1.12 src/lib/libm/src/s_expm1.c:1.13
--- src/lib/libm/src/s_expm1.c:1.12	Sun May 26 22:01:55 2002
+++ src/lib/libm/src/s_expm1.c	Thu Feb  9 22:11:09 2017
@@ -12,7 +12,7 @@
 
 #include 
 #if defined(LIBM_SCCS) && !defined(lint)
-__RCSID("$NetBSD: s_expm1.c,v 1.12 2002/05/26 22:01:55 wiz Exp $");
+__RCSID("$NetBSD: s_expm1.c,v 1.13 2017/02/09 22:11:09 maya Exp $");
 #endif
 
 /* expm1(x)
@@ -138,7 +138,9 @@ expm1(double x)
 	c = 0;
 	GET_HIGH_WORD(hx,x);
 	xsb = hx&0x8000;		/* sign bit of x */
+#ifdef DEAD_CODE
 	if(xsb==0) y=x; else y= -x;	/* y = |x| */
+#endif
 	hx &= 0x7fff;		/* high word of |x| */
 
 /* filter out huge and non-finite argument */

Index: src/lib/libm/src/s_expm1f.c
diff -u src/lib/libm/src/s_expm1f.c:1.10 src/lib/libm/src/s_expm1f.c:1.11
--- src/lib/libm/src/s_expm1f.c:1.10	Sun May 26 22:01:55 2002
+++ src/lib/libm/src/s_expm1f.c	Thu Feb  9 22:11:09 2017
@@ -15,7 +15,7 @@
 
 #include 
 #if defined(LIBM_SCCS) && !defined(lint)
-__RCSID("$NetBSD: s_expm1f.c,v 1.10 2002/05/26 22:01:55 wiz Exp $");
+__RCSID("$NetBSD: s_expm1f.c,v 1.11 2017/02/09 22:11:09 maya Exp $");
 #endif
 
 #include "math.h"
@@ -46,7 +46,9 @@ expm1f(float x)
 	c = 0;
 	GET_FLOAT_WORD(hx,x);
 	xsb = hx&0x8000;		/* sign bit of x */
+#ifdef DEAD_CODE
 	if(xsb==0) y=x; else y= -x;	/* y = |x| */
+#endif
 	hx &= 0x7fff;		/* high word of |x| */
 
 /* filter out huge and non-finite argument */



CVS commit: src/lib/libm/src

2017-02-09 Thread Maya Rashish
Module Name:src
Committed By:   maya
Date:   Thu Feb  9 22:11:09 UTC 2017

Modified Files:
src/lib/libm/src: s_expm1.c s_expm1f.c

Log Message:
ifdef out some dead code. improves code readability.
all later users of y first assign another value.

using ifdefs to make potential future code syncs easier, as is done
elsewhere.

suggested by coverity, CID 1300929, 1300930.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/lib/libm/src/s_expm1.c
cvs rdiff -u -r1.10 -r1.11 src/lib/libm/src/s_expm1f.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/lib/libm/src

2017-02-09 Thread Maya Rashish
Module Name:src
Committed By:   maya
Date:   Thu Feb  9 21:23:11 UTC 2017

Modified Files:
src/lib/libm/src: e_j0.c e_j0f.c e_j1.c e_j1f.c

Log Message:
Appease static analyzers by making all code paths which assign
values into p,q sane. Get rid of redundant assignment. Indent
for legibility. NFC.

This doesn't create a functional difference, as all callers
test number >= 0x4000 anyway.

To see this, note the following:
- consistently, hx is the high bits of x, lx is the low bits,
  x is the float.
- & 0x7fff zeroes the sign bit, as does fabs.

A case where it isn't easy to see that there's no functional
change is y1, which does:

ix = hx & 0x7fff (zero signbit of high bits of x)
y = fabs(x) (this has a zeroed signbit but otherwise same as x)
ix >= 0x4000
  pone(y); qone(y)

qone(x) (also pone) do:
  ix = hx & 0x7fff

ix in qone and in the calling function are the same number,
and the comparison applies for both, and ix < 0x4000 isn't
possible.

(Also, no explosions seem to happen when I feed it random numbers)


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/lib/libm/src/e_j0.c src/lib/libm/src/e_j1.c
cvs rdiff -u -r1.10 -r1.11 src/lib/libm/src/e_j0f.c
cvs rdiff -u -r1.11 -r1.12 src/lib/libm/src/e_j1f.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_j0.c
diff -u src/lib/libm/src/e_j0.c:1.12 src/lib/libm/src/e_j0.c:1.13
--- src/lib/libm/src/e_j0.c:1.12	Mon Aug 20 16:01:38 2007
+++ src/lib/libm/src/e_j0.c	Thu Feb  9 21:23:11 2017
@@ -12,7 +12,7 @@
 
 #include 
 #if defined(LIBM_SCCS) && !defined(lint)
-__RCSID("$NetBSD: e_j0.c,v 1.12 2007/08/20 16:01:38 drochner Exp $");
+__RCSID("$NetBSD: e_j0.c,v 1.13 2017/02/09 21:23:11 maya Exp $");
 #endif
 
 /* __ieee754_j0(x), __ieee754_y0(x)
@@ -277,13 +277,12 @@ pzero(double x)
 	double z,r,s;
 	int32_t ix;
 
-	p = q = 0;
 	GET_HIGH_WORD(ix,x);
 	ix &= 0x7fff;
-	if(ix>=0x4020) {p = pR8; q= pS8;}
-	else if(ix>=0x40122E8B){p = pR5; q= pS5;}
-	else if(ix>=0x4006DB6D){p = pR3; q= pS3;}
-	else if(ix>=0x4000){p = pR2; q= pS2;}
+	if(ix>=0x4020) {p = pR8; q= pS8;}
+	else if(ix>=0x40122E8B){p = pR5; q= pS5;}
+	else if(ix>=0x4006DB6D){p = pR3; q= pS3;}
+	else /*if(ix>=0x4000)*/{p = pR2; q= pS2;}
 	z = one/(x*x);
 	r = p[0]+z*(p[1]+z*(p[2]+z*(p[3]+z*(p[4]+z*p[5];
 	s = one+z*(q[0]+z*(q[1]+z*(q[2]+z*(q[3]+z*q[4];
@@ -375,13 +374,12 @@ qzero(double x)
 	double s,r,z;
 	int32_t ix;
 
-	p = q = 0;
 	GET_HIGH_WORD(ix,x);
 	ix &= 0x7fff;
-	if(ix>=0x4020) {p = qR8; q= qS8;}
-	else if(ix>=0x40122E8B){p = qR5; q= qS5;}
-	else if(ix>=0x4006DB6D){p = qR3; q= qS3;}
-	else if(ix>=0x4000){p = qR2; q= qS2;}
+	if(ix>=0x4020) {p = qR8; q= qS8;}
+	else if(ix>=0x40122E8B){p = qR5; q= qS5;}
+	else if(ix>=0x4006DB6D){p = qR3; q= qS3;}
+	else /*if(ix>=0x4000)*/{p = qR2; q= qS2;}
 	z = one/(x*x);
 	r = p[0]+z*(p[1]+z*(p[2]+z*(p[3]+z*(p[4]+z*p[5];
 	s = one+z*(q[0]+z*(q[1]+z*(q[2]+z*(q[3]+z*(q[4]+z*q[5]);
Index: src/lib/libm/src/e_j1.c
diff -u src/lib/libm/src/e_j1.c:1.12 src/lib/libm/src/e_j1.c:1.13
--- src/lib/libm/src/e_j1.c:1.12	Mon Aug 20 16:01:38 2007
+++ src/lib/libm/src/e_j1.c	Thu Feb  9 21:23:11 2017
@@ -12,7 +12,7 @@
 
 #include 
 #if defined(LIBM_SCCS) && !defined(lint)
-__RCSID("$NetBSD: e_j1.c,v 1.12 2007/08/20 16:01:38 drochner Exp $");
+__RCSID("$NetBSD: e_j1.c,v 1.13 2017/02/09 21:23:11 maya Exp $");
 #endif
 
 /* __ieee754_j1(x), __ieee754_y1(x)
@@ -271,13 +271,12 @@ pone(double x)
 	double z,r,s;
 int32_t ix;
 
-	p = q = 0;
 	GET_HIGH_WORD(ix,x);
 	ix &= 0x7fff;
-if(ix>=0x4020) {p = pr8; q= ps8;}
-else if(ix>=0x40122E8B){p = pr5; q= ps5;}
-else if(ix>=0x4006DB6D){p = pr3; q= ps3;}
-else if(ix>=0x4000){p = pr2; q= ps2;}
+if(ix>=0x4020) {p = pr8; q= ps8;}
+else if(ix>=0x40122E8B){p = pr5; q= ps5;}
+else if(ix>=0x4006DB6D){p = pr3; q= ps3;}
+else /*if(ix>=0x4000)*/{p = pr2; q= ps2;}
 z = one/(x*x);
 r = p[0]+z*(p[1]+z*(p[2]+z*(p[3]+z*(p[4]+z*p[5];
 s = one+z*(q[0]+z*(q[1]+z*(q[2]+z*(q[3]+z*q[4];
@@ -370,13 +369,12 @@ qone(double x)
 	double  s,r,z;
 	int32_t ix;
 
-	p = q = 0;
 	GET_HIGH_WORD(ix,x);
 	ix &= 0x7fff;
-	if(ix>=0x4020) {p = qr8; q= qs8;}
-	else if(ix>=0x40122E8B){p = qr5; q= qs5;}
-	else if(ix>=0x4006DB6D){p = qr3; q= qs3;}
-	else if(ix>=0x4000){p = qr2; q= qs2;}
+	if(ix>=0x4020) {p = qr8; q= qs8;}
+	else if(ix>=0x40122E8B){p = qr5; q= qs5;}
+	else if(ix>=0x4006DB6D){p = qr3; q= qs3;}
+	else /*if(ix>=0x4000)*/{p = qr2; q= qs2;}
 	z = one/(x*x);
 	r = p[0]+z*(p[1]+z*(p[2]+z*(p[3]+z*(p[4]+z*p[5];
 	s = one+z*(q[0]+z*(q[1]+z*(q[2]+z*(q[3]+z*(q[4]+z*q[5]);

Index: src/lib/libm/src/e_j0f.c
diff -u 

CVS commit: src/lib/libm/src

2017-02-09 Thread Maya Rashish
Module Name:src
Committed By:   maya
Date:   Thu Feb  9 21:23:11 UTC 2017

Modified Files:
src/lib/libm/src: e_j0.c e_j0f.c e_j1.c e_j1f.c

Log Message:
Appease static analyzers by making all code paths which assign
values into p,q sane. Get rid of redundant assignment. Indent
for legibility. NFC.

This doesn't create a functional difference, as all callers
test number >= 0x4000 anyway.

To see this, note the following:
- consistently, hx is the high bits of x, lx is the low bits,
  x is the float.
- & 0x7fff zeroes the sign bit, as does fabs.

A case where it isn't easy to see that there's no functional
change is y1, which does:

ix = hx & 0x7fff (zero signbit of high bits of x)
y = fabs(x) (this has a zeroed signbit but otherwise same as x)
ix >= 0x4000
  pone(y); qone(y)

qone(x) (also pone) do:
  ix = hx & 0x7fff

ix in qone and in the calling function are the same number,
and the comparison applies for both, and ix < 0x4000 isn't
possible.

(Also, no explosions seem to happen when I feed it random numbers)


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/lib/libm/src/e_j0.c src/lib/libm/src/e_j1.c
cvs rdiff -u -r1.10 -r1.11 src/lib/libm/src/e_j0f.c
cvs rdiff -u -r1.11 -r1.12 src/lib/libm/src/e_j1f.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/lib/libm/src

2016-08-27 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Aug 27 10:03:16 UTC 2016

Modified Files:
src/lib/libm/src: k_standard.c

Log Message:
no need for stdio.


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/lib/libm/src/k_standard.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/k_standard.c
diff -u src/lib/libm/src/k_standard.c:1.21 src/lib/libm/src/k_standard.c:1.22
--- src/lib/libm/src/k_standard.c:1.21	Sat Aug 27 06:00:38 2016
+++ src/lib/libm/src/k_standard.c	Sat Aug 27 06:03:16 2016
@@ -12,13 +12,12 @@
 
 #include 
 #if defined(LIBM_SCCS) && !defined(lint)
-__RCSID("$NetBSD: k_standard.c,v 1.21 2016/08/27 10:00:38 christos Exp $");
+__RCSID("$NetBSD: k_standard.c,v 1.22 2016/08/27 10:03:16 christos Exp $");
 #endif
 
 #include "math.h"
 #include "math_private.h"
 #include 
-#include 
 
 #ifndef _USE_WRITE
 #include 			/* fputs(), stderr */



CVS commit: src/lib/libm/src

2016-08-27 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Aug 27 10:03:16 UTC 2016

Modified Files:
src/lib/libm/src: k_standard.c

Log Message:
no need for stdio.


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/lib/libm/src/k_standard.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/lib/libm/src

2016-08-27 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Aug 27 10:00:38 UTC 2016

Modified Files:
src/lib/libm/src: k_standard.c

Log Message:
correct case 23 for -0.0


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/lib/libm/src/k_standard.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/k_standard.c
diff -u src/lib/libm/src/k_standard.c:1.20 src/lib/libm/src/k_standard.c:1.21
--- src/lib/libm/src/k_standard.c:1.20	Tue Sep  8 01:23:31 2015
+++ src/lib/libm/src/k_standard.c	Sat Aug 27 06:00:38 2016
@@ -12,12 +12,13 @@
 
 #include 
 #if defined(LIBM_SCCS) && !defined(lint)
-__RCSID("$NetBSD: k_standard.c,v 1.20 2015/09/08 05:23:31 dholland Exp $");
+__RCSID("$NetBSD: k_standard.c,v 1.21 2016/08/27 10:00:38 christos Exp $");
 #endif
 
 #include "math.h"
 #include "math_private.h"
 #include 
+#include 
 
 #ifndef _USE_WRITE
 #include 			/* fputs(), stderr */
@@ -468,8 +469,11 @@ __kernel_standard(double x, double y, in
 		exc.name = type < 100 ? "pow" : "powf";
 		if (_LIB_VERSION == _SVID_)
 		  exc.retval = zero;
-		else
+		else {
 		  exc.retval = HUGE_VAL;
+		  y *= 0.5;
+		  if(signbit(x)&(y)!=y) exc.retval = -HUGE_VAL;
+		}
 		if (_LIB_VERSION == _POSIX_)
 		  errno = EDOM;
 		else if (!matherr()) {



CVS commit: src/lib/libm/src

2016-08-27 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Aug 27 10:00:38 UTC 2016

Modified Files:
src/lib/libm/src: k_standard.c

Log Message:
correct case 23 for -0.0


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/lib/libm/src/k_standard.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/lib/libm/src

2016-08-27 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Aug 27 10:01:08 UTC 2016

Modified Files:
src/lib/libm/src: e_pow.c e_powf.c

Log Message:
sync with FreeBSD


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/lib/libm/src/e_pow.c
cvs rdiff -u -r1.15 -r1.16 src/lib/libm/src/e_powf.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_pow.c
diff -u src/lib/libm/src/e_pow.c:1.16 src/lib/libm/src/e_pow.c:1.17
--- src/lib/libm/src/e_pow.c:1.16	Fri Apr 23 15:17:07 2010
+++ src/lib/libm/src/e_pow.c	Sat Aug 27 06:01:08 2016
@@ -1,9 +1,8 @@
-/* @(#)e_pow.c 5.1 93/09/24 */
+/* @(#)e_pow.c 1.5 04/04/22 SMI */
 /*
  * 
- * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ * Copyright (C) 2004 by Sun Microsystems, Inc. All rights reserved.
  *
- * Developed at SunPro, a Sun Microsystems, Inc. business.
  * Permission to use, copy, modify, and distribute this
  * software is freely granted, provided that this notice
  * is preserved.
@@ -12,7 +11,7 @@
 
 #include 
 #if defined(LIBM_SCCS) && !defined(lint)
-__RCSID("$NetBSD: e_pow.c,v 1.16 2010/04/23 19:17:07 drochner Exp $");
+__RCSID("$NetBSD: e_pow.c,v 1.17 2016/08/27 10:01:08 christos Exp $");
 #endif
 
 /* __ieee754_pow(x,y) return x**y
@@ -29,13 +28,13 @@ __RCSID("$NetBSD: e_pow.c,v 1.16 2010/04
  * Special cases:
  *	1.  (anything) ** 0  is 1
  *	2.  (anything) ** 1  is itself
- *	3.  (anything) ** NAN is NAN
+ *	3.  (anything) ** NAN is NAN except 1 ** NAN = 1
  *	4.  NAN ** (anything except 0) is NAN
  *	5.  +-(|x| > 1) **  +INF is +INF
  *	6.  +-(|x| > 1) **  -INF is +0
  *	7.  +-(|x| < 1) **  +INF is +0
  *	8.  +-(|x| < 1) **  -INF is +INF
- *	9.  +-1 ** +-INF is NAN
+ *	9.  +-1 ** +-INF is 1
  *	10. +0 ** (+anything except 0, NAN)   is +0
  *	11. -0 ** (+anything except 0, NAN, odd integer)  is +0
  *	12. +0 ** (-anything except 0, NAN)   is +INF
@@ -113,10 +112,13 @@ __ieee754_pow(double x, double y)
 /* y==zero: x**0 = 1 */
 	if((iy|ly)==0) return one;
 
-/* +-NaN return x+y */
+/* x==1: 1**y = 1, even if y is NaN */
+	if (hx==0x3ff0 && lx == 0) return one;
+
+/* y!=zero: result is NaN if either arg is NaN */
 	if(ix > 0x7ff0 || ((ix==0x7ff0)&&(lx!=0)) ||
 	   iy > 0x7ff0 || ((iy==0x7ff0)&&(ly!=0)))
-		return x+y;
+		return (x+0.0)+(y+0.0);
 
 /* determine if y is an odd int when x < 0
  * yisint = 0	... y is not an integer
@@ -142,7 +144,7 @@ __ieee754_pow(double x, double y)
 	if(ly==0) {
 	if (iy==0x7ff0) {	/* y is +-inf */
 	if(((ix-0x3ff0)|lx)==0)
-		return  y - y;	/* inf**+-1 is NaN */
+		return  one;	/* (-1)**+-inf is 1 */
 	else if (ix >= 0x3ff0)/* (|x|>1)**+-inf = inf,0 */
 		return (hy>=0)? y: zero;
 	else			/* (|x|<1)**-,+inf = inf,0 */
@@ -174,7 +176,11 @@ __ieee754_pow(double x, double y)
 	}
 	}
 
+/* CYGNUS LOCAL + fdlibm-5.3 fix: This used to be
 	n = (hx>>31)+1;
+   but ANSI C says a right shift of a signed negative quantity is
+   implementation defined.  */
+	n = ((u_int32_t)hx>>31)-1;
 
 /* (x<0)**(non-int) is NaN */
 	if((n|yisint)==0) return (x-x)/(x-x);

Index: src/lib/libm/src/e_powf.c
diff -u src/lib/libm/src/e_powf.c:1.15 src/lib/libm/src/e_powf.c:1.16
--- src/lib/libm/src/e_powf.c:1.15	Fri Apr 23 15:17:07 2010
+++ src/lib/libm/src/e_powf.c	Sat Aug 27 06:01:08 2016
@@ -15,15 +15,13 @@
 
 #include 
 #if defined(LIBM_SCCS) && !defined(lint)
-__RCSID("$NetBSD: e_powf.c,v 1.15 2010/04/23 19:17:07 drochner Exp $");
+__RCSID("$NetBSD: e_powf.c,v 1.16 2016/08/27 10:01:08 christos Exp $");
 #endif
 
 #include "namespace.h"
 #include "math.h"
 #include "math_private.h"
 
-static const float huge = 1.0e+30, tiny = 1.0e-30;
-
 static const float
 bp[] = {1.0, 1.5,},
 dp_h[] = { 0.0, 5.84960938e-01,}, /* 0x3f15c000 */
@@ -32,6 +30,8 @@ zero=  0.0,
 one	=  1.0,
 two	=  2.0,
 two24	=  16777216.0,	/* 0x4b80 */
+huge	=  1.0e30,
+tiny=  1.0e-30,
 	/* poly coefs for (3/2)*(log(x)-2s-2/3*s**3 */
 L1  =  6.002384e-01, /* 0x3f1a */
 L2  =  4.2857143283e-01, /* 0x3edb6db7 */
@@ -49,8 +49,8 @@ lg2_h  =  6.93145752e-01, /* 0x3f317200 
 lg2_l  =  1.42860654e-06, /* 0x35bfbe8c */
 ovt =  4.2995665694e-08, /* -(128-log2(ovfl+.5ulp)) */
 cp=  9.6179670095e-01, /* 0x3f76384f =2/(3ln2) */
-cp_h  =  9.6179199219e-01, /* 0x3f763800 =head of cp */
-cp_l  =  4.7017383622e-06, /* 0x369dc3a0 =tail of cp_h */
+cp_h  =  9.6191406250e-01, /* 0x3f764000 =12b cp */
+cp_l  = -1.1736857402e-04, /* 0xb8f623c6 =tail of cp_h */
 ivln2=  1.4426950216e+00, /* 0x3fb8aa3b =1/ln2 */
 ivln2_h  =  1.4426879883e+00, /* 0x3fb8aa00 =16b 1/ln2*/
 ivln2_l  =  7.0526075433e-06; /* 0x36eca570 =1/ln2 tail*/
@@ -59,7 +59,7 @@ float
 __ieee754_powf(float x, float y)
 {
 	float z,ax,z_h,z_l,p_h,p_l;
-	

CVS commit: src/lib/libm/src

2016-08-27 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Aug 27 10:01:08 UTC 2016

Modified Files:
src/lib/libm/src: e_pow.c e_powf.c

Log Message:
sync with FreeBSD


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/lib/libm/src/e_pow.c
cvs rdiff -u -r1.15 -r1.16 src/lib/libm/src/e_powf.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/lib/libm/src

2016-08-26 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Aug 26 08:20:31 UTC 2016

Modified Files:
src/lib/libm/src: s_ilogb.c s_ilogbf.c s_ilogbl.c

Log Message:
fix sun2 build; only IEEE math platform (and coldfire) without fenv


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/lib/libm/src/s_ilogb.c
cvs rdiff -u -r1.9 -r1.10 src/lib/libm/src/s_ilogbf.c
cvs rdiff -u -r1.3 -r1.4 src/lib/libm/src/s_ilogbl.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_ilogb.c
diff -u src/lib/libm/src/s_ilogb.c:1.15 src/lib/libm/src/s_ilogb.c:1.16
--- src/lib/libm/src/s_ilogb.c:1.15	Wed Aug 24 06:03:32 2016
+++ src/lib/libm/src/s_ilogb.c	Fri Aug 26 04:20:31 2016
@@ -12,7 +12,7 @@
 
 #include 
 #if defined(LIBM_SCCS) && !defined(lint)
-__RCSID("$NetBSD: s_ilogb.c,v 1.15 2016/08/24 10:03:32 christos Exp $");
+__RCSID("$NetBSD: s_ilogb.c,v 1.16 2016/08/26 08:20:31 christos Exp $");
 #endif
 
 /* ilogb(double x)
@@ -22,7 +22,11 @@ __RCSID("$NetBSD: s_ilogb.c,v 1.15 2016/
  */
 
 #include 
+#define __TEST_FENV
 #include 
+#ifndef __HAVE_FENV
+#define feraiseexcept(a)
+#endif
 #include "math_private.h"
 
 #ifndef __HAVE_LONG_DOUBLE

Index: src/lib/libm/src/s_ilogbf.c
diff -u src/lib/libm/src/s_ilogbf.c:1.9 src/lib/libm/src/s_ilogbf.c:1.10
--- src/lib/libm/src/s_ilogbf.c:1.9	Wed Aug 24 06:03:32 2016
+++ src/lib/libm/src/s_ilogbf.c	Fri Aug 26 04:20:31 2016
@@ -15,11 +15,15 @@
 
 #include 
 #if defined(LIBM_SCCS) && !defined(lint)
-__RCSID("$NetBSD: s_ilogbf.c,v 1.9 2016/08/24 10:03:32 christos Exp $");
+__RCSID("$NetBSD: s_ilogbf.c,v 1.10 2016/08/26 08:20:31 christos Exp $");
 #endif
 
 #include 
+#define __TEST_FENV
 #include 
+#ifndef __HAVE_FENV
+#define feraiseexcept(a)
+#endif
 #include "math_private.h"
 
 int

Index: src/lib/libm/src/s_ilogbl.c
diff -u src/lib/libm/src/s_ilogbl.c:1.3 src/lib/libm/src/s_ilogbl.c:1.4
--- src/lib/libm/src/s_ilogbl.c:1.3	Wed Aug 24 06:03:32 2016
+++ src/lib/libm/src/s_ilogbl.c	Fri Aug 26 04:20:31 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: s_ilogbl.c,v 1.3 2016/08/24 10:03:32 christos Exp $	*/
+/*	$NetBSD: s_ilogbl.c,v 1.4 2016/08/26 08:20:31 christos Exp $	*/
 
 /*-
  * Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -30,13 +30,17 @@
  */
 
 #include 
-__RCSID("$NetBSD: s_ilogbl.c,v 1.3 2016/08/24 10:03:32 christos Exp $");
+__RCSID("$NetBSD: s_ilogbl.c,v 1.4 2016/08/26 08:20:31 christos Exp $");
 
 #include "namespace.h"
 
 #include 
 #include 
+#define __TEST_FENV
 #include 
+#ifndef __HAVE_FENV
+#define feraiseexcept(a)
+#endif
 #include 
 
 #ifdef __HAVE_LONG_DOUBLE



CVS commit: src/lib/libm/src

2016-08-26 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Aug 26 08:20:31 UTC 2016

Modified Files:
src/lib/libm/src: s_ilogb.c s_ilogbf.c s_ilogbl.c

Log Message:
fix sun2 build; only IEEE math platform (and coldfire) without fenv


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/lib/libm/src/s_ilogb.c
cvs rdiff -u -r1.9 -r1.10 src/lib/libm/src/s_ilogbf.c
cvs rdiff -u -r1.3 -r1.4 src/lib/libm/src/s_ilogbl.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/lib/libm/src

2016-01-24 Thread Andreas Gustafsson
Module Name:src
Committed By:   gson
Date:   Sun Jan 24 20:34:30 UTC 2016

Modified Files:
src/lib/libm/src: e_hypotf.c

Log Message:
Fix incorrect magic numbers in scaling.  From FreeBSD commit 23397, by
way of Rin Okuyama.  Fixes PR lib/50698.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/lib/libm/src/e_hypotf.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_hypotf.c
diff -u src/lib/libm/src/e_hypotf.c:1.9 src/lib/libm/src/e_hypotf.c:1.10
--- src/lib/libm/src/e_hypotf.c:1.9	Fri Apr 25 22:21:53 2008
+++ src/lib/libm/src/e_hypotf.c	Sun Jan 24 20:34:30 2016
@@ -15,7 +15,7 @@
 
 #include 
 #if defined(LIBM_SCCS) && !defined(lint)
-__RCSID("$NetBSD: e_hypotf.c,v 1.9 2008/04/25 22:21:53 christos Exp $");
+__RCSID("$NetBSD: e_hypotf.c,v 1.10 2016/01/24 20:34:30 gson Exp $");
 #endif
 
 #include "math.h"
@@ -43,22 +43,22 @@ __ieee754_hypotf(float x, float y)
 	   if(hb == 0x7f80) w = b;
 	   return w;
 	   }
-	   /* scale a and b by 2**-60 */
-	   ha -= 0x5d80; hb -= 0x5d80;	k += 60;
+	   /* scale a and b by 2**-68 */
+	   ha -= 0x2200; hb -= 0x2200;	k += 68;
 	   SET_FLOAT_WORD(a,ha);
 	   SET_FLOAT_WORD(b,hb);
 	}
 	if(hb < 0x2680) {	/* b < 2**-50 */
 	if(hb <= 0x007f) {	/* subnormal b or 0 */
 	if(hb==0) return a;
-		SET_FLOAT_WORD(t1,0x3f00);	/* t1=2^126 */
+		SET_FLOAT_WORD(t1,0x7e80);	/* t1=2^126 */
 		b *= t1;
 		a *= t1;
 		k -= 126;
-	} else {		/* scale a and b by 2^60 */
-	ha += 0x5d80; 	/* a *= 2^60 */
-		hb += 0x5d80;	/* b *= 2^60 */
-		k -= 60;
+	} else {		/* scale a and b by 2^68 */
+	ha += 0x2200; 	/* a *= 2^68 */
+		hb += 0x2200;	/* b *= 2^68 */
+		k -= 68;
 		SET_FLOAT_WORD(a,ha);
 		SET_FLOAT_WORD(b,hb);
 	}



CVS commit: src/lib/libm/src

2016-01-24 Thread Andreas Gustafsson
Module Name:src
Committed By:   gson
Date:   Sun Jan 24 20:34:30 UTC 2016

Modified Files:
src/lib/libm/src: e_hypotf.c

Log Message:
Fix incorrect magic numbers in scaling.  From FreeBSD commit 23397, by
way of Rin Okuyama.  Fixes PR lib/50698.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/lib/libm/src/e_hypotf.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/lib/libm/src

2015-09-07 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Tue Sep  8 05:23:31 UTC 2015

Modified Files:
src/lib/libm/src: k_standard.c

Log Message:
Apply patch in PR 45391 from Yui NARUSE: generate HUGE_VAL rather than
-HUGE_VAL for 0^negative. No objection after asking nearly two years
ago if I shouldn't just commit it.


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/lib/libm/src/k_standard.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/k_standard.c
diff -u src/lib/libm/src/k_standard.c:1.19 src/lib/libm/src/k_standard.c:1.20
--- src/lib/libm/src/k_standard.c:1.19	Tue Nov 19 19:24:34 2013
+++ src/lib/libm/src/k_standard.c	Tue Sep  8 05:23:31 2015
@@ -12,7 +12,7 @@
 
 #include 
 #if defined(LIBM_SCCS) && !defined(lint)
-__RCSID("$NetBSD: k_standard.c,v 1.19 2013/11/19 19:24:34 joerg Exp $");
+__RCSID("$NetBSD: k_standard.c,v 1.20 2015/09/08 05:23:31 dholland Exp $");
 #endif
 
 #include "math.h"
@@ -469,7 +469,7 @@ __kernel_standard(double x, double y, in
 		if (_LIB_VERSION == _SVID_)
 		  exc.retval = zero;
 		else
-		  exc.retval = -HUGE_VAL;
+		  exc.retval = HUGE_VAL;
 		if (_LIB_VERSION == _POSIX_)
 		  errno = EDOM;
 		else if (!matherr()) {



CVS commit: src/lib/libm/src

2015-09-07 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Tue Sep  8 05:23:31 UTC 2015

Modified Files:
src/lib/libm/src: k_standard.c

Log Message:
Apply patch in PR 45391 from Yui NARUSE: generate HUGE_VAL rather than
-HUGE_VAL for 0^negative. No objection after asking nearly two years
ago if I shouldn't just commit it.


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/lib/libm/src/k_standard.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/lib/libm/src

2015-07-09 Thread Nathanial Sloss
Module Name:src
Committed By:   nat
Date:   Thu Jul  9 06:17:13 UTC 2015

Modified Files:
src/lib/libm/src: lrint.c lrintf.c

Log Message:
Return x for = DBL_FRACBITS in lrint.c.
Return x for = SNG_FRACBITS in lrintf.c

Addresses PR lib/49690

This commit was approved by christos@


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/lib/libm/src/lrint.c
cvs rdiff -u -r1.5 -r1.6 src/lib/libm/src/lrintf.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



  1   2   3   >