Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
This patch renames all uses of __isinf*, __isnan*, __finite* and __si…
…gnbit* to use standard C99 macros. This has no effect on generated code.
  • Loading branch information
Wilco Dijkstra committed Jun 3, 2015
1 parent f014e87 commit d81f90c
Show file tree
Hide file tree
Showing 90 changed files with 268 additions and 175 deletions.
93 changes: 93 additions & 0 deletions ChangeLog
@@ -1,3 +1,96 @@
2015-06-03 Wilco Dijkstra <wdijkstr@arm.com>

* math/e_exp10.c: Replace __isinf*, __isnan*, __finite* and
__signbit* with standard C99 macros.
* math/e_exp10l.c: Likewise.
* math/e_exp2l.c: Likewise.
* math/e_scalb.c: Likewise.
* math/e_scalbf.c: Likewise.
* math/e_scalbl.c: Likewise.
* math/s_ldexp.c: Likewise.
* math/s_ldexpf.c: Likewise.
* math/s_ldexpl.c: Likewise.
* math/w_atan2.c: Likewise.
* math/w_atan2f.c: Likewise.
* math/w_atan2l.c: Likewise.
* math/w_cosh.c: Likewise.
* math/w_coshf.c: Likewise.
* math/w_coshl.c: Likewise.
* math/w_exp10.c: Likewise.
* math/w_exp10f.c: Likewise.
* math/w_exp10l.c: Likewise.
* math/w_exp2.c: Likewise.
* math/w_exp2f.c: Likewise.
* math/w_exp2l.c: Likewise.
* math/w_fmod.c: Likewise.
* math/w_fmodf.c: Likewise.
* math/w_fmodl.c: Likewise.
* math/w_hypot.c: Likewise.
* math/w_hypotf.c: Likewise.
* math/w_hypotl.c: Likewise.
* math/w_jnl.c: Likewise.
* math/w_lgamma.c: Likewise.
* math/w_lgamma_r.c: Likewise.
* math/w_lgammaf.c: Likewise.
* math/w_lgammaf_r.c: Likewise.
* math/w_lgammal.c: Likewise.
* math/w_lgammal_r.c: Likewise.
* math/w_pow.c: Likewise.
* math/w_powf.c: Likewise.
* math/w_powl.c: Likewise.
* math/w_remainder.c: Likewise.
* math/w_remainderf.c: Likewise.
* math/w_remainderl.c: Likewise.
* math/w_scalb.c: Likewise.
* math/w_scalbf.c: Likewise.
* math/w_scalbl.c: Likewise.
* math/w_scalbln.c: Likewise.
* math/w_scalblnf.c: Likewise.
* math/w_scalblnl.c: Likewise.
* math/w_sinh.c: Likewise.
* math/w_sinhf.c: Likewise.
* math/w_sinhl.c: Likewise.
* math/w_tgamma.c: Likewise.
* math/w_tgammaf.c: Likewise.
* math/w_tgammal.c: Likewise.
* sysdeps/ieee754/dbl-64/e_exp.c: Likewise.
* sysdeps/ieee754/dbl-64/e_exp10.c: Likewise.
* sysdeps/ieee754/dbl-64/e_exp2.c: Likewise.
* sysdeps/ieee754/dbl-64/e_j1.c: Likewise.
* sysdeps/ieee754/dbl-64/e_jn.c: Likewise.
* sysdeps/ieee754/dbl-64/e_pow.c: Likewise.
* sysdeps/ieee754/dbl-64/w_exp.c: Likewise.
* sysdeps/ieee754/flt-32/e_expf.c: Likewise.
* sysdeps/ieee754/flt-32/e_j1f.c: Likewise.
* sysdeps/ieee754/flt-32/e_jnf.c: Likewise.
* sysdeps/ieee754/flt-32/w_expf.c: Likewise.
* sysdeps/ieee754/ldbl-128/e_exp10l.c: Likewise.
* sysdeps/ieee754/ldbl-128/e_expl.c: Likewise.
* sysdeps/ieee754/ldbl-128/e_j0l.c: Likewise.
* sysdeps/ieee754/ldbl-128/e_j1l.c: Likewise.
* sysdeps/ieee754/ldbl-128/e_jnl.c: Likewise.
* sysdeps/ieee754/ldbl-128/e_lgammal_r.c: Likewise.
* sysdeps/ieee754/ldbl-128/s_cbrtl.c: Likewise.
* sysdeps/ieee754/ldbl-128/w_expl.c: Likewise.
* sysdeps/ieee754/ldbl-128ibm/e_acosl.c: Likewise.
* sysdeps/ieee754/ldbl-128ibm/e_asinl.c: Likewise.
* sysdeps/ieee754/ldbl-128ibm/e_exp10l.c: Likewise.
* sysdeps/ieee754/ldbl-128ibm/e_expl.c: Likewise.
* sysdeps/ieee754/ldbl-128ibm/e_jnl.c: Likewise.
* sysdeps/ieee754/ldbl-128ibm/s_ctanhl.c: Likewise.
* sysdeps/ieee754/ldbl-128ibm/s_ctanl.c: Likewise.
* sysdeps/ieee754/ldbl-128ibm/w_expl.c: Likewise.
* sysdeps/ieee754/ldbl-96/e_j1l.c: Likewise.
* sysdeps/ieee754/ldbl-96/e_jnl.c: Likewise.
* sysdeps/ieee754/ldbl-96/w_expl.c: Likewise.
* sysdeps/ieee754/ldbl-opt/nldbl-finite.c: Likewise.
* sysdeps/ieee754/ldbl-opt/nldbl-isinf.c: Likewise.
* sysdeps/ieee754/ldbl-opt/nldbl-isnan.c: Likewise.
* sysdeps/ieee754/ldbl-opt/nldbl-signbit.c: Likewise.
* stdio-common/printf_fp.c: Likewise.
* stdio-common/printf_fphex.c: Likewise.
* stdio-common/printf_size.c: Likewise.

2015-06-03 Joseph Myers <joseph@codesourcery.com>

[BZ #18470]
Expand Down
2 changes: 1 addition & 1 deletion math/e_exp10.c
Expand Up @@ -23,7 +23,7 @@
double
__ieee754_exp10 (double arg)
{
if (__finite (arg) && arg < DBL_MIN_10_EXP - DBL_DIG - 10)
if (isfinite (arg) && arg < DBL_MIN_10_EXP - DBL_DIG - 10)
return DBL_MIN * DBL_MIN;
else
/* This is a very stupid and inprecise implementation. It'll get
Expand Down
2 changes: 1 addition & 1 deletion math/e_exp10l.c
Expand Up @@ -23,7 +23,7 @@
long double
__ieee754_exp10l (long double arg)
{
if (__finitel (arg) && arg < LDBL_MIN_10_EXP - LDBL_DIG - 10)
if (isfinite (arg) && arg < LDBL_MIN_10_EXP - LDBL_DIG - 10)
return LDBL_MIN * LDBL_MIN;
else
/* This is a very stupid and inprecise implementation. It'll get
Expand Down
2 changes: 1 addition & 1 deletion math/e_exp2l.c
Expand Up @@ -45,7 +45,7 @@ __ieee754_exp2l (long double x)
else
{
/* Underflow or exact zero. */
if (__isinfl (x))
if (isinf (x))
return 0;
else
return LDBL_MIN * LDBL_MIN;
Expand Down
6 changes: 3 additions & 3 deletions math/e_scalb.c
Expand Up @@ -40,11 +40,11 @@ invalid_fn (double x, double fn)
double
__ieee754_scalb (double x, double fn)
{
if (__glibc_unlikely (__isnan (x)))
if (__glibc_unlikely (isnan (x)))
return x * fn;
if (__glibc_unlikely (!__finite (fn)))
if (__glibc_unlikely (!isfinite (fn)))
{
if (__isnan (fn) || fn > 0.0)
if (isnan (fn) || fn > 0.0)
return x * fn;
if (x == 0.0)
return x;
Expand Down
6 changes: 3 additions & 3 deletions math/e_scalbf.c
Expand Up @@ -40,11 +40,11 @@ invalid_fn (float x, float fn)
float
__ieee754_scalbf (float x, float fn)
{
if (__glibc_unlikely (__isnanf (x)))
if (__glibc_unlikely (isnan (x)))
return x * fn;
if (__glibc_unlikely (!__finitef (fn)))
if (__glibc_unlikely (!isfinite (fn)))
{
if (__isnanf (fn) || fn > 0.0f)
if (isnan (fn) || fn > 0.0f)
return x * fn;
if (x == 0.0f)
return x;
Expand Down
6 changes: 3 additions & 3 deletions math/e_scalbl.c
Expand Up @@ -40,11 +40,11 @@ invalid_fn (long double x, long double fn)
long double
__ieee754_scalbl (long double x, long double fn)
{
if (__glibc_unlikely (__isnanl (x)))
if (__glibc_unlikely (isnan (x)))
return x * fn;
if (__glibc_unlikely (!__finitel (fn)))
if (__glibc_unlikely (!isfinite (fn)))
{
if (__isnanl (fn) || fn > 0.0L)
if (isnan (fn) || fn > 0.0L)
return x * fn;
if (x == 0.0L)
return x;
Expand Down
4 changes: 2 additions & 2 deletions math/s_ldexp.c
Expand Up @@ -20,9 +20,9 @@ static char rcsid[] = "$NetBSD: s_ldexp.c,v 1.6 1995/05/10 20:47:40 jtc Exp $";

double __ldexp(double value, int exp)
{
if(!__finite(value)||value==0.0) return value;
if(!isfinite(value)||value==0.0) return value;
value = __scalbn(value,exp);
if(!__finite(value)||value==0.0) __set_errno (ERANGE);
if(!isfinite(value)||value==0.0) __set_errno (ERANGE);
return value;
}
weak_alias (__ldexp, ldexp)
Expand Down
4 changes: 2 additions & 2 deletions math/s_ldexpf.c
Expand Up @@ -23,9 +23,9 @@ static char rcsid[] = "$NetBSD: s_ldexpf.c,v 1.3 1995/05/10 20:47:42 jtc Exp $";

float __ldexpf(float value, int exp)
{
if(!__finitef(value)||value==(float)0.0) return value;
if(!isfinite(value)||value==(float)0.0) return value;
value = __scalbnf(value,exp);
if(!__finitef(value)||value==(float)0.0) __set_errno (ERANGE);
if(!isfinite(value)||value==(float)0.0) __set_errno (ERANGE);
return value;
}
weak_alias (__ldexpf, ldexpf)
4 changes: 2 additions & 2 deletions math/s_ldexpl.c
Expand Up @@ -24,9 +24,9 @@ static char rcsid[] = "$NetBSD: $";

long double __ldexpl(long double value, int exp)
{
if(!__finitel(value)||value==0.0) return value;
if(!isfinite(value)||value==0.0) return value;
value = __scalbnl(value,exp);
if(!__finitel(value)||value==0.0) __set_errno (ERANGE);
if(!isfinite(value)||value==0.0) __set_errno (ERANGE);
return value;
}
weak_alias (__ldexpl, ldexpl)
2 changes: 1 addition & 1 deletion math/w_atan2.c
Expand Up @@ -34,7 +34,7 @@ __atan2 (double y, double x)
return __kernel_standard (y, x, 3); /* atan2(+-0,+-0) */

z = __ieee754_atan2 (y, x);
if (__glibc_unlikely (z == 0.0 && y != 0.0 && __finite (x)))
if (__glibc_unlikely (z == 0.0 && y != 0.0 && isfinite (x)))
__set_errno (ERANGE);
return z;
}
Expand Down
2 changes: 1 addition & 1 deletion math/w_atan2f.c
Expand Up @@ -34,7 +34,7 @@ __atan2f (float y, float x)
return __kernel_standard_f (y, x, 103); /* atan2(+-0,+-0) */

z = __ieee754_atan2f (y, x);
if (__glibc_unlikely (z == 0.0f && y != 0.0f && __finitef (x)))
if (__glibc_unlikely (z == 0.0f && y != 0.0f && isfinite (x)))
__set_errno (ERANGE);
return z;
}
Expand Down
2 changes: 1 addition & 1 deletion math/w_atan2l.c
Expand Up @@ -34,7 +34,7 @@ __atan2l (long double y, long double x)
return __kernel_standard_l (y, x, 203); /* atan2(+-0,+-0) */

z = __ieee754_atan2l (y, x);
if (__glibc_unlikely (z == 0.0L && y != 0.0L && __finitel (x)))
if (__glibc_unlikely (z == 0.0L && y != 0.0L && isfinite (x)))
__set_errno (ERANGE);
return z;
}
Expand Down
2 changes: 1 addition & 1 deletion math/w_cosh.c
Expand Up @@ -21,7 +21,7 @@ double
__cosh (double x)
{
double z = __ieee754_cosh (x);
if (__builtin_expect (!__finite (z), 0) && __finite (x)
if (__builtin_expect (!isfinite (z), 0) && isfinite (x)
&& _LIB_VERSION != _IEEE_)
return __kernel_standard (x, x, 5); /* cosh overflow */

Expand Down
2 changes: 1 addition & 1 deletion math/w_coshf.c
Expand Up @@ -25,7 +25,7 @@ float
__coshf (float x)
{
float z = __ieee754_coshf (x);
if (__builtin_expect (!__finitef (z), 0) && __finitef (x)
if (__builtin_expect (!isfinite (z), 0) && isfinite (x)
&& _LIB_VERSION != _IEEE_)
return __kernel_standard_f (x, x, 105); /* cosh overflow */

Expand Down
2 changes: 1 addition & 1 deletion math/w_coshl.c
Expand Up @@ -26,7 +26,7 @@ long double
__coshl (long double x)
{
long double z = __ieee754_coshl (x);
if (__builtin_expect (!__finitel (z), 0) && __finitel (x)
if (__builtin_expect (!isfinite (z), 0) && isfinite (x)
&& _LIB_VERSION != _IEEE_)
return __kernel_standard_l (x, x, 205); /* cosh overflow */

Expand Down
6 changes: 3 additions & 3 deletions math/w_exp10.c
Expand Up @@ -28,10 +28,10 @@ double
__exp10 (double x)
{
double z = __ieee754_exp10 (x);
if (__builtin_expect (!__finite (z) || z == 0, 0)
&& __finite (x) && _LIB_VERSION != _IEEE_)
if (__builtin_expect (!isfinite (z) || z == 0, 0)
&& isfinite (x) && _LIB_VERSION != _IEEE_)
/* exp10 overflow (46) if x > 0, underflow (47) if x < 0. */
return __kernel_standard (x, x, 46 + !!__signbit (x));
return __kernel_standard (x, x, 46 + !!signbit (x));

return z;
}
Expand Down
6 changes: 3 additions & 3 deletions math/w_exp10f.c
Expand Up @@ -28,10 +28,10 @@ float
__exp10f (float x)
{
float z = __ieee754_exp10f (x);
if (__builtin_expect (!__finitef (z) || z == 0, 0)
&& __finitef (x) && _LIB_VERSION != _IEEE_)
if (__builtin_expect (!isfinite (z) || z == 0, 0)
&& isfinite (x) && _LIB_VERSION != _IEEE_)
/* exp10f overflow (146) if x > 0, underflow (147) if x < 0. */
return __kernel_standard_f (x, x, 146 + !!__signbitf (x));
return __kernel_standard_f (x, x, 146 + !!signbit (x));

return z;
}
Expand Down
6 changes: 3 additions & 3 deletions math/w_exp10l.c
Expand Up @@ -28,10 +28,10 @@ long double
__exp10l (long double x)
{
long double z = __ieee754_exp10l (x);
if (__builtin_expect (!__finitel (z) || z == 0, 0)
&& __finitel (x) && _LIB_VERSION != _IEEE_)
if (__builtin_expect (!isfinite (z) || z == 0, 0)
&& isfinite (x) && _LIB_VERSION != _IEEE_)
/* exp10l overflow (246) if x > 0, underflow (247) if x < 0. */
return __kernel_standard_l (x, x, 246 + !!__signbitl (x));
return __kernel_standard_l (x, x, 246 + !!signbit (x));

return z;
}
Expand Down
6 changes: 3 additions & 3 deletions math/w_exp2.c
Expand Up @@ -9,10 +9,10 @@ double
__exp2 (double x)
{
double z = __ieee754_exp2 (x);
if (__builtin_expect (!__finite (z) || z == 0, 0)
&& __finite (x) && _LIB_VERSION != _IEEE_)
if (__builtin_expect (!isfinite (z) || z == 0, 0)
&& isfinite (x) && _LIB_VERSION != _IEEE_)
/* exp2 overflow: 44, exp2 underflow: 45 */
return __kernel_standard (x, x, 44 + !!__signbit (x));
return __kernel_standard (x, x, 44 + !!signbit (x));

return z;
}
Expand Down
6 changes: 3 additions & 3 deletions math/w_exp2f.c
Expand Up @@ -9,10 +9,10 @@ float
__exp2f (float x)
{
float z = __ieee754_exp2f (x);
if (__builtin_expect (!__finitef (z) || z == 0, 0)
&& __finitef (x) && _LIB_VERSION != _IEEE_)
if (__builtin_expect (!isfinite (z) || z == 0, 0)
&& isfinite (x) && _LIB_VERSION != _IEEE_)
/* exp2 overflow: 144, exp2 underflow: 145 */
return __kernel_standard_f (x, x, 144 + !!__signbitf (x));
return __kernel_standard_f (x, x, 144 + !!signbit (x));

return z;
}
Expand Down
6 changes: 3 additions & 3 deletions math/w_exp2l.c
Expand Up @@ -9,10 +9,10 @@ long double
__exp2l (long double x)
{
long double z = __ieee754_exp2l (x);
if (__builtin_expect (!__finitel (z) || z == 0, 0)
&& __finitel (x) && _LIB_VERSION != _IEEE_)
if (__builtin_expect (!isfinite (z) || z == 0, 0)
&& isfinite (x) && _LIB_VERSION != _IEEE_)
/* exp2 overflow: 244, exp2 underflow: 245 */
return __kernel_standard_l (x, x, 244 + !!__signbitl (x));
return __kernel_standard_l (x, x, 244 + !!signbit (x));

return z;
}
Expand Down
2 changes: 1 addition & 1 deletion math/w_fmod.c
Expand Up @@ -24,7 +24,7 @@ double
__fmod (double x, double y)
{
if (__builtin_expect (__isinf_ns (x) || y == 0.0, 0)
&& _LIB_VERSION != _IEEE_ && !__isnan (y) && !__isnan (x))
&& _LIB_VERSION != _IEEE_ && !isnan (y) && !isnan (x))
/* fmod(+-Inf,y) or fmod(x,0) */
return __kernel_standard (x, y, 27);

Expand Down
2 changes: 1 addition & 1 deletion math/w_fmodf.c
Expand Up @@ -24,7 +24,7 @@ float
__fmodf (float x, float y)
{
if (__builtin_expect (__isinf_nsf (x) || y == 0.0f, 0)
&& _LIB_VERSION != _IEEE_ && !__isnanf (y) && !__isnanf (x))
&& _LIB_VERSION != _IEEE_ && !isnan (y) && !isnan (x))
/* fmod(+-Inf,y) or fmod(x,0) */
return __kernel_standard_f (x, y, 127);

Expand Down
2 changes: 1 addition & 1 deletion math/w_fmodl.c
Expand Up @@ -24,7 +24,7 @@ long double
__fmodl (long double x, long double y)
{
if (__builtin_expect (__isinf_nsl (x) || y == 0.0L, 0)
&& _LIB_VERSION != _IEEE_ && !__isnanl (y) && !__isnanl (x))
&& _LIB_VERSION != _IEEE_ && !isnan (y) && !isnan (x))
/* fmod(+-Inf,y) or fmod(x,0) */
return __kernel_standard_l (x, y, 227);

Expand Down
4 changes: 2 additions & 2 deletions math/w_hypot.c
Expand Up @@ -22,8 +22,8 @@ double
__hypot (double x, double y)
{
double z = __ieee754_hypot(x,y);
if(__builtin_expect(!__finite(z), 0)
&& __finite(x) && __finite(y) && _LIB_VERSION != _IEEE_)
if(__builtin_expect(!isfinite(z), 0)
&& isfinite(x) && isfinite(y) && _LIB_VERSION != _IEEE_)
return __kernel_standard(x, y, 4); /* hypot overflow */

return z;
Expand Down
4 changes: 2 additions & 2 deletions math/w_hypotf.c
Expand Up @@ -25,8 +25,8 @@ float
__hypotf(float x, float y)
{
float z = __ieee754_hypotf(x,y);
if(__builtin_expect(!__finitef(z), 0)
&& __finitef(x) && __finitef(y) && _LIB_VERSION != _IEEE_)
if(__builtin_expect(!isfinite(z), 0)
&& isfinite(x) && isfinite(y) && _LIB_VERSION != _IEEE_)
/* hypot overflow */
return __kernel_standard_f(x, y, 104);

Expand Down

0 comments on commit d81f90c

Please sign in to comment.