mirror of
https://git.planet-casio.com/Lephenixnoir/OpenLibm.git
synced 2024-12-29 13:03:42 +01:00
Prevent the use of deprecated or internal functions if possible.
The finite() function has been superseded by isfinite(). There is also no need to use scalb(), as the exponent is also an integer value. We can simply use scalbn(). There is also no need to use __isnanf(). The values passed are guaranteed to be of type float, meaning we can safely use the standard isnan().
This commit is contained in:
parent
7df63d456e
commit
71f60ec632
4 changed files with 7 additions and 7 deletions
|
@ -152,13 +152,13 @@ double x, c;
|
||||||
c= x - z*(p1+z*(p2+z*(p3+z*(p4+z*p5))));
|
c= x - z*(p1+z*(p2+z*(p3+z*(p4+z*p5))));
|
||||||
c = (x*c)/(2.0-c);
|
c = (x*c)/(2.0-c);
|
||||||
|
|
||||||
return scalb(1.+(hi-(lo - c)), k);
|
return scalbn(1.+(hi-(lo - c)), k);
|
||||||
}
|
}
|
||||||
/* end of x > lntiny */
|
/* end of x > lntiny */
|
||||||
|
|
||||||
else
|
else
|
||||||
/* exp(-big#) underflows to zero */
|
/* exp(-big#) underflows to zero */
|
||||||
if(finite(x)) return(scalb(1.0,-5000));
|
if(isfinite(x)) return(scalbn(1.0,-5000));
|
||||||
|
|
||||||
/* exp(-INF) is zero */
|
/* exp(-INF) is zero */
|
||||||
else return(0.0);
|
else return(0.0);
|
||||||
|
@ -167,5 +167,5 @@ double x, c;
|
||||||
|
|
||||||
else
|
else
|
||||||
/* exp(INF) is INF, exp(+big#) overflows to INF */
|
/* exp(INF) is INF, exp(+big#) overflows to INF */
|
||||||
return( finite(x) ? scalb(1.0,5000) : x);
|
return( isfinite(x) ? scalbn(1.0,5000) : x);
|
||||||
}
|
}
|
||||||
|
|
|
@ -140,7 +140,7 @@ tgamma(x)
|
||||||
if (x != 0.0)
|
if (x != 0.0)
|
||||||
u.a = one - tiny; /* raise inexact */
|
u.a = one - tiny; /* raise inexact */
|
||||||
return (one/x);
|
return (one/x);
|
||||||
} else if (!finite(x))
|
} else if (!isfinite(x))
|
||||||
return (x - x); /* x is NaN or -Inf */
|
return (x - x); /* x is NaN or -Inf */
|
||||||
else
|
else
|
||||||
return (neg_gam(x));
|
return (neg_gam(x));
|
||||||
|
|
|
@ -35,7 +35,7 @@ __ieee754_scalb(double x, double fn)
|
||||||
return scalbn(x,fn);
|
return scalbn(x,fn);
|
||||||
#else
|
#else
|
||||||
if (isnan(x)||isnan(fn)) return x*fn;
|
if (isnan(x)||isnan(fn)) return x*fn;
|
||||||
if (!finite(fn)) {
|
if (!isfinite(fn)) {
|
||||||
if(fn>0.0) return x*fn;
|
if(fn>0.0) return x*fn;
|
||||||
else return x/(-fn);
|
else return x/(-fn);
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,8 +30,8 @@ __ieee754_scalbf(float x, float fn)
|
||||||
#ifdef _SCALB_INT
|
#ifdef _SCALB_INT
|
||||||
return scalbnf(x,fn);
|
return scalbnf(x,fn);
|
||||||
#else
|
#else
|
||||||
if ((__isnanf)(x)||(__isnanf)(fn)) return x*fn;
|
if (isnan(x)||isnan(fn)) return x*fn;
|
||||||
if (!finitef(fn)) {
|
if (!isfinite(fn)) {
|
||||||
if(fn>(float)0.0) return x*fn;
|
if(fn>(float)0.0) return x*fn;
|
||||||
else return x/(-fn);
|
else return x/(-fn);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue