Re: libm: don't use deprecated classification macros

2016-09-11 Thread Theo Buehler
On Sat, Sep 10, 2016 at 01:33:26PM -0700, Philip Guenther wrote:
> 
> fpclassify(3) says:
> 
>  The symbols isinff(), and isnanf() are provided as compatibility aliases
>  to isinf(), and isnan(), respectively, and their uses are deprecated.
>  Similarly, finite() and finitef() are deprecated versions of isfinite().
> 
> So let's use the preferred names in libm.
> 
> ok?

ok



libm: don't use deprecated classification macros

2016-09-10 Thread Philip Guenther

fpclassify(3) says:

 The symbols isinff(), and isnanf() are provided as compatibility aliases
 to isinf(), and isnan(), respectively, and their uses are deprecated.
 Similarly, finite() and finitef() are deprecated versions of isfinite().

So let's use the preferred names in libm.

ok?

Philip


Index: noieee_src/n_atan2.c
===
RCS file: /cvs/src/lib/libm/noieee_src/n_atan2.c,v
retrieving revision 1.18
diff -u -p -r1.18 n_atan2.c
--- noieee_src/n_atan2.c15 Jul 2013 04:08:26 -  1.18
+++ noieee_src/n_atan2.c10 Sep 2016 20:30:34 -
@@ -151,7 +151,7 @@ atan2(double y, double x)
signx = copysign(one,x) ;
 
 /* if x is 1.0, goto begin */
-   if(x==1) { y=copysign(y,one); t=y; if(finite(t)) goto begin;}
+   if(x==1) { y=copysign(y,one); t=y; if(isfinite(t)) goto begin;}
 
 /* when y = 0 */
if(y==zero) return((signx==one)?y:copysign(PI,signy));
@@ -160,14 +160,14 @@ atan2(double y, double x)
if(x==zero) return(copysign(PIo2,signy));
 
 /* when x is INF */
-   if(!finite(x))
-   if(!finite(y))
+   if(!isfinite(x))
+   if(!isfinite(y))
return(copysign((signx==one)?PIo4:3*PIo4,signy));
else
return(copysign((signx==one)?zero:PI,signy));
 
 /* when y is INF */
-   if(!finite(y)) return(copysign(PIo2,signy));
+   if(!isfinite(y)) return(copysign(PIo2,signy));
 
 /* compute y/x */
x=copysign(x,one);
Index: noieee_src/n_erf.c
===
RCS file: /cvs/src/lib/libm/noieee_src/n_erf.c,v
retrieving revision 1.7
diff -u -p -r1.7 n_erf.c
--- noieee_src/n_erf.c  27 Oct 2009 23:59:29 -  1.7
+++ noieee_src/n_erf.c  10 Sep 2016 20:30:34 -
@@ -255,7 +255,7 @@ double
 erf(double x)
 {
double R, S, P, Q, ax, s, y, z, r;
-   if(!finite(x)) {/* erf(nan)=nan */
+   if(!isfinite(x)) {  /* erf(nan)=nan */
if (isnan(x))
return(x);
return (x > 0 ? one : -one); /* erf(+/-inf)= +/-1 */
@@ -313,7 +313,7 @@ double
 erfc(double x)
 {
double R, S, P, Q, s, ax, y, z, r;
-   if (!finite(x)) {
+   if (!isfinite(x)) {
if (isnan(x))   /* erfc(NaN) = NaN */
return(x);
else if (x > 0) /* erfc(+-inf)=0,2 */
Index: noieee_src/n_exp.c
===
RCS file: /cvs/src/lib/libm/noieee_src/n_exp.c,v
retrieving revision 1.10
diff -u -p -r1.10 n_exp.c
--- noieee_src/n_exp.c  27 Oct 2009 23:59:29 -  1.10
+++ noieee_src/n_exp.c  10 Sep 2016 20:30:35 -
@@ -37,7 +37,7 @@
  * Required system supported functions:
  * scalbn(x,n)
  * copysign(x,y)
- * finite(x)
+ * isfinite(x)
  *
  * Method:
  * 1. Argument Reduction: given the input x, find r and integer k such
@@ -115,7 +115,7 @@ exp(double x)
 
else
 /* exp(-big#) underflows to zero */
-if(finite(x))  return(scalbn(1.0,-5000));
+if(isfinite(x))  return(scalbn(1.0,-5000));
 
 /* exp(-INF) is zero */
 else return(0.0);
@@ -124,7 +124,7 @@ exp(double x)
 
else
/* exp(INF) is INF, exp(+big#) overflows to INF */
-   return( finite(x) ?  scalbn(1.0,5000)  : x);
+   return( isfinite(x) ?  scalbn(1.0,5000)  : x);
 }
 
 /* returns exp(r = x + c) for |c| < |x| with no overlap.  */
@@ -160,7 +160,7 @@ __exp__D(double x, double c)
 
else
 /* exp(-big#) underflows to zero */
-if(finite(x))  return(scalbn(1.0,-5000));
+if(isfinite(x))  return(scalbn(1.0,-5000));
 
 /* exp(-INF) is zero */
 else return(0.0);
@@ -169,5 +169,5 @@ __exp__D(double x, double c)
 
else
/* exp(INF) is INF, exp(+big#) overflows to INF */
-   return( finite(x) ?  scalbn(1.0,5000)  : x);
+   return( isfinite(x) ?  scalbn(1.0,5000)  : x);
 }
Index: noieee_src/n_expm1.c
===
RCS file: /cvs/src/lib/libm/noieee_src/n_expm1.c,v
retrieving revision 1.12
diff -u -p -r1.12 n_expm1.c
--- noieee_src/n_expm1.c27 Oct 2009 23:59:29 -  1.12
+++ noieee_src/n_expm1.c10 Sep 2016 20:30:35 -
@@ -38,7 +38,7 @@
  * Required system supported functions:
  * scalbn(x,n)
  * copysign(x,y)
- * finite(x)
+ * isfinite(x)
  *
  * Kernel function:
  * exp__E(x,c)
@@ -135,7 +135,7 @@ expm1(double x)
 
else
 /* expm1(-big#) rounded to -1 (inexact) */
-if(finite(x))
+if(isfinite(x))
return(tiny-one);
 
 /*