aboutsummaryrefslogtreecommitdiff
path: root/sysdeps/ieee754/ldbl-96
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@gmail.com>2011-10-12 11:27:51 -0400
committerUlrich Drepper <drepper@gmail.com>2011-10-12 11:27:51 -0400
commit0ac5ae2335292908f39031b1ea9fe8edce433c0f (patch)
treef9d26c8abc0de39d18d4c13e70f6022cdc6b461f /sysdeps/ieee754/ldbl-96
parenta843a204a3e8a0dd53584dad3668771abaec84ac (diff)
downloadglibc-0ac5ae2335292908f39031b1ea9fe8edce433c0f.tar
glibc-0ac5ae2335292908f39031b1ea9fe8edce433c0f.tar.gz
glibc-0ac5ae2335292908f39031b1ea9fe8edce433c0f.tar.bz2
glibc-0ac5ae2335292908f39031b1ea9fe8edce433c0f.zip
Optimize libm
libm is now somewhat integrated with gcc's -ffinite-math-only option and lots of the wrapper functions have been optimized.
Diffstat (limited to 'sysdeps/ieee754/ldbl-96')
-rw-r--r--sysdeps/ieee754/ldbl-96/e_acoshl.c19
-rw-r--r--sysdeps/ieee754/ldbl-96/e_asinl.c7
-rw-r--r--sysdeps/ieee754/ldbl-96/e_atan2l.c29
-rw-r--r--sysdeps/ieee754/ldbl-96/e_atanhl.c23
-rw-r--r--sysdeps/ieee754/ldbl-96/e_coshl.c46
-rw-r--r--sysdeps/ieee754/ldbl-96/e_gammal_r.c13
-rw-r--r--sysdeps/ieee754/ldbl-96/e_hypotl.c17
-rw-r--r--sysdeps/ieee754/ldbl-96/e_j0l.c138
-rw-r--r--sysdeps/ieee754/ldbl-96/e_j1l.c156
-rw-r--r--sysdeps/ieee754/ldbl-96/e_jnl.c41
-rw-r--r--sysdeps/ieee754/ldbl-96/e_lgammal_r.c30
-rw-r--r--sysdeps/ieee754/ldbl-96/e_remainderl.c23
-rw-r--r--sysdeps/ieee754/ldbl-96/e_sinhl.c21
-rw-r--r--sysdeps/ieee754/ldbl-96/s_asinhl.c22
14 files changed, 130 insertions, 455 deletions
diff --git a/sysdeps/ieee754/ldbl-96/e_acoshl.c b/sysdeps/ieee754/ldbl-96/e_acoshl.c
index 5d4fa1deda..6f709b7bdf 100644
--- a/sysdeps/ieee754/ldbl-96/e_acoshl.c
+++ b/sysdeps/ieee754/ldbl-96/e_acoshl.c
@@ -14,10 +14,6 @@
* ====================================================
*/
-#if defined(LIBM_SCCS) && !defined(lint)
-static char rcsid[] = "$NetBSD: $";
-#endif
-
/* __ieee754_acoshl(x)
* Method :
* Based on
@@ -35,20 +31,12 @@ static char rcsid[] = "$NetBSD: $";
#include "math.h"
#include "math_private.h"
-#ifdef __STDC__
static const long double
-#else
-static long double
-#endif
one = 1.0,
ln2 = 6.931471805599453094287e-01L; /* 0x3FFE, 0xB17217F7, 0xD1CF79AC */
-#ifdef __STDC__
- long double __ieee754_acoshl(long double x)
-#else
- long double __ieee754_acoshl(x)
- long double x;
-#endif
+long double
+__ieee754_acoshl(long double x)
{
long double t;
u_int32_t se,i0,i1;
@@ -57,7 +45,7 @@ ln2 = 6.931471805599453094287e-01L; /* 0x3FFE, 0xB17217F7, 0xD1CF79AC */
return (x-x)/(x-x);
} else if(se >=0x401d) { /* x > 2**30 */
if(se >=0x7fff) { /* x is inf of NaN */
- return x+x;
+ return x+x;
} else
return __ieee754_logl(x)+ln2; /* acoshl(huge)=logl(2x) */
} else if(((se-0x3fff)|i0|i1)==0) {
@@ -70,3 +58,4 @@ ln2 = 6.931471805599453094287e-01L; /* 0x3FFE, 0xB17217F7, 0xD1CF79AC */
return __log1pl(t+__sqrtl(2.0*t+t*t));
}
}
+strong_alias (__ieee754_acoshl, __acoshl_finite)
diff --git a/sysdeps/ieee754/ldbl-96/e_asinl.c b/sysdeps/ieee754/ldbl-96/e_asinl.c
index 1cad623d43..d813039311 100644
--- a/sysdeps/ieee754/ldbl-96/e_asinl.c
+++ b/sysdeps/ieee754/ldbl-96/e_asinl.c
@@ -12,9 +12,9 @@
/*
Long double expansions are
Copyright (C) 2001 Stephen L. Moshier <moshier@na-net.ornl.gov>
- and are incorporated herein by permission of the author. The author
+ and are incorporated herein by permission of the author. The author
reserves the right to distribute this material elsewhere under different
- copying permissions. These modifications are distributed here under
+ copying permissions. These modifications are distributed here under
the following terms:
This library is free software; you can redistribute it and/or
@@ -45,7 +45,7 @@
* = pio2_hi - (2*(s+s*z*R(z)) - pio2_lo)
* For x<=0.98, let pio4_hi = pio2_hi/2, then
* f = hi part of s;
- * c = sqrt(z) - f = (z-f*f)/(s+f) ...f+c=sqrt(z)
+ * c = sqrt(z) - f = (z-f*f)/(s+f) ...f+c=sqrt(z)
* and
* asin(x) = pi/2 - 2*(s+s*z*R(z))
* = pio4_hi+(pio4-2s)-(2s*z*R(z)-pio2_lo)
@@ -159,3 +159,4 @@ __ieee754_asinl (x)
else
return -t;
}
+strong_alias (__ieee754_asinl, __asinl_finite)
diff --git a/sysdeps/ieee754/ldbl-96/e_atan2l.c b/sysdeps/ieee754/ldbl-96/e_atan2l.c
index 0759458c2f..535d0d6123 100644
--- a/sysdeps/ieee754/ldbl-96/e_atan2l.c
+++ b/sysdeps/ieee754/ldbl-96/e_atan2l.c
@@ -14,15 +14,11 @@
* ====================================================
*/
-#if defined(LIBM_SCCS) && !defined(lint)
-static char rcsid[] = "$NetBSD: $";
-#endif
-
/* __ieee754_atan2l(y,x)
* Method :
* 1. Reduce y to positive by atan2(y,x)=-atan2(-y,x).
* 2. Reduce x to positive by (if x and y are unexceptional):
- * ARG (x+iy) = arctan(y/x) ... if x > 0,
+ * ARG (x+iy) = arctan(y/x) ... if x > 0,
* ARG (x+iy) = pi - arctan[y/(-x)] ... if x < 0,
*
* Special cases:
@@ -48,11 +44,7 @@ static char rcsid[] = "$NetBSD: $";
#include "math.h"
#include "math_private.h"
-#ifdef __STDC__
static const long double
-#else
-static long double
-#endif
tiny = 1.0e-4900L,
zero = 0.0,
pi_o_4 = 7.85398163397448309628202E-01L, /* 0x3FFE, 0xC90FDAA2, 0x2168C235 */
@@ -60,12 +52,8 @@ pi_o_2 = 1.5707963267948966192564E+00L, /* 0x3FFF, 0xC90FDAA2, 0x2168C235 */
pi = 3.14159265358979323851281E+00L, /* 0x4000, 0xC90FDAA2, 0x2168C235 */
pi_lo = -5.01655761266833202345176e-20L;/* 0xBFBE, 0xECE675D1, 0xFC8F8CBB */
-#ifdef __STDC__
- long double __ieee754_atan2l(long double y, long double x)
-#else
- long double __ieee754_atan2l(y,x)
- long double y,x;
-#endif
+long double
+__ieee754_atan2l (long double y, long double x)
{
long double z;
int32_t k,m,hx,hy,ix,iy;
@@ -87,7 +75,7 @@ pi_lo = -5.01655761266833202345176e-20L;/* 0xBFBE, 0xECE675D1, 0xFC8F8CBB */
if((iy|ly)==0) {
switch(m) {
case 0:
- case 1: return y; /* atan(+-0,+anything)=+-0 */
+ case 1: return y; /* atan(+-0,+anything)=+-0 */
case 2: return pi+tiny;/* atan(+0,-anything) = pi */
case 3: return -pi-tiny;/* atan(-0,-anything) =-pi */
}
@@ -118,19 +106,20 @@ pi_lo = -5.01655761266833202345176e-20L;/* 0xBFBE, 0xECE675D1, 0xFC8F8CBB */
/* compute y/x */
k = sy-sx;
- if(k > 70) z=pi_o_2+0.5*pi_lo; /* |y/x| > 2**70 */
- else if(sx>=0x8000&&k<-70) z=0.0; /* |y|/x < -2**70 */
+ if(k > 70) z=pi_o_2+0.5*pi_lo; /* |y/x| > 2**70 */
+ else if(sx>=0x8000&&k<-70) z=0.0; /* |y|/x < -2**70 */
else z=__atanl(fabsl(y/x)); /* safe to do y/x */
switch (m) {
case 0: return z ; /* atan(+,+) */
case 1: {
- u_int32_t sz;
+ u_int32_t sz;
GET_LDOUBLE_EXP(sz,z);
SET_LDOUBLE_EXP(z,sz ^ 0x8000);
}
return z ; /* atan(-,+) */
case 2: return pi-(z-pi_lo);/* atan(+,-) */
default: /* case 3 */
- return (z-pi_lo)-pi;/* atan(-,-) */
+ return (z-pi_lo)-pi;/* atan(-,-) */
}
}
+strong_alias (__ieee754_atan2l, __atan2l_finite)
diff --git a/sysdeps/ieee754/ldbl-96/e_atanhl.c b/sysdeps/ieee754/ldbl-96/e_atanhl.c
index fdcd1e9fe8..5a2aebef3e 100644
--- a/sysdeps/ieee754/ldbl-96/e_atanhl.c
+++ b/sysdeps/ieee754/ldbl-96/e_atanhl.c
@@ -14,10 +14,6 @@
* ====================================================
*/
-#if defined(LIBM_SCCS) && !defined(lint)
-static char rcsid[] = "$NetBSD: $";
-#endif
-
/* __ieee754_atanhl(x)
* Method :
* 1.Reduced x to positive by atanh(-x) = -atanh(x)
@@ -26,7 +22,7 @@ static char rcsid[] = "$NetBSD: $";
* atanhl(x) = --- * log(1 + -------) = 0.5 * log1p(2 * --------)
* 2 1 - x 1 - x
*
- * For x<0.5
+ * For x<0.5
* atanhl(x) = 0.5*log1pl(2x+2x*x/(1-x))
*
* Special cases:
@@ -39,24 +35,12 @@ static char rcsid[] = "$NetBSD: $";
#include "math.h"
#include "math_private.h"
-#ifdef __STDC__
static const long double one = 1.0, huge = 1e4900L;
-#else
-static long double one = 1.0, huge = 1e4900L;
-#endif
-#ifdef __STDC__
static const long double zero = 0.0;
-#else
-static double long zero = 0.0;
-#endif
-#ifdef __STDC__
- long double __ieee754_atanhl(long double x)
-#else
- long double __ieee754_atanhl(x)
- long double x;
-#endif
+long double
+__ieee754_atanhl(long double x)
{
long double t;
int32_t ix;
@@ -77,3 +61,4 @@ static double long zero = 0.0;
t = 0.5*__log1pl((x+x)/(one-x));
if(se<=0x7fff) return t; else return -t;
}
+strong_alias (__ieee754_atanhl, __atanhl_finite)
diff --git a/sysdeps/ieee754/ldbl-96/e_coshl.c b/sysdeps/ieee754/ldbl-96/e_coshl.c
index 8c38fa4da2..6113f0719f 100644
--- a/sysdeps/ieee754/ldbl-96/e_coshl.c
+++ b/sysdeps/ieee754/ldbl-96/e_coshl.c
@@ -18,13 +18,13 @@ static char rcsid[] = "$NetBSD: e_cosh.c,v 1.7 1995/05/10 20:44:58 jtc Exp $";
* mathematically coshl(x) if defined to be (exp(x)+exp(-x))/2
* 1. Replace x by |x| (coshl(x) = coshl(-x)).
* 2.
- * [ exp(x) - 1 ]^2
+ * [ exp(x) - 1 ]^2
* 0 <= x <= ln2/2 : coshl(x) := 1 + -------------------
- * 2*exp(x)
+ * 2*exp(x)
*
- * exp(x) + 1/exp(x)
+ * exp(x) + 1/exp(x)
* ln2/2 <= x <= 22 : coshl(x) := -------------------
- * 2
+ * 2
* 22 <= x <= lnovft : coshl(x) := expl(x)/2
* lnovft <= x <= ln2ovft: coshl(x) := expl(x/2)/2 * expl(x/2)
* ln2ovft < x : coshl(x) := huge*huge (overflow)
@@ -37,18 +37,10 @@ static char rcsid[] = "$NetBSD: e_cosh.c,v 1.7 1995/05/10 20:44:58 jtc Exp $";
#include "math.h"
#include "math_private.h"
-#ifdef __STDC__
static const long double one = 1.0, half=0.5, huge = 1.0e4900L;
-#else
-static long double one = 1.0, half=0.5, huge = 1.0e4900L;
-#endif
-#ifdef __STDC__
- long double __ieee754_coshl(long double x)
-#else
- long double __ieee754_coshl(x)
- long double x;
-#endif
+long double
+__ieee754_coshl (long double x)
{
long double t,w;
int32_t ex;
@@ -58,19 +50,17 @@ static long double one = 1.0, half=0.5, huge = 1.0e4900L;
GET_LDOUBLE_WORDS(ex,mx,lx,x);
ex &= 0x7fff;
- /* x is INF or NaN */
- if(ex==0x7fff) return x*x;
-
- /* |x| in [0,0.5*ln2], return 1+expm1l(|x|)^2/(2*expl(|x|)) */
- if(ex < 0x3ffd || (ex == 0x3ffd && mx < 0xb17217f7u)) {
- t = __expm1l(fabsl(x));
- w = one+t;
- if (ex<0x3fbc) return w; /* cosh(tiny) = 1 */
- return one+(t*t)/(w+w);
- }
-
- /* |x| in [0.5*ln2,22], return (exp(|x|)+1/exp(|x|)/2; */
+ /* |x| in [0,22] */
if (ex < 0x4003 || (ex == 0x4003 && mx < 0xb0000000u)) {
+ /* |x| in [0,0.5*ln2], return 1+expm1l(|x|)^2/(2*expl(|x|)) */
+ if(ex < 0x3ffd || (ex == 0x3ffd && mx < 0xb17217f7u)) {
+ t = __expm1l(fabsl(x));
+ w = one+t;
+ if (ex<0x3fbc) return w; /* cosh(tiny) = 1 */
+ return one+(t*t)/(w+w);
+ }
+
+ /* |x| in [0.5*ln2,22], return (exp(|x|)+1/exp(|x|)/2; */
t = __ieee754_expl(fabsl(x));
return half*t+half/t;
}
@@ -88,6 +78,10 @@ static long double one = 1.0, half=0.5, huge = 1.0e4900L;
return t*w;
}
+ /* x is INF or NaN */
+ if(ex==0x7fff) return x*x;
+
/* |x| >= log(2*maxdouble), cosh(x) overflow */
return huge*huge;
}
+strong_alias (__ieee754_coshl, __coshl_finite)
diff --git a/sysdeps/ieee754/ldbl-96/e_gammal_r.c b/sysdeps/ieee754/ldbl-96/e_gammal_r.c
index dd956fed95..40c18ea584 100644
--- a/sysdeps/ieee754/ldbl-96/e_gammal_r.c
+++ b/sysdeps/ieee754/ldbl-96/e_gammal_r.c
@@ -1,5 +1,5 @@
/* Implementation of gamma function according to ISO C.
- Copyright (C) 1997, 1999, 2001, 2003, 2004 Free Software Foundation, Inc.
+ Copyright (C) 1997,1999,2001,2003,2004,2011 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
@@ -32,25 +32,27 @@ __ieee754_gammal_r (long double x, int *signgamp)
GET_LDOUBLE_WORDS (es, hx, lx, x);
- if (((es & 0x7fff) | hx | lx) == 0)
+ if (__builtin_expect (((es & 0x7fff) | hx | lx) == 0, 0))
{
/* Return value for x == 0 is Inf with divide by zero exception. */
*signgamp = 0;
return 1.0 / x;
}
- if (es == 0xffffffff && ((hx & 0x7fffffff) | lx) == 0)
+ if (__builtin_expect (es == 0xffffffff && ((hx & 0x7fffffff) | lx) == 0, 0))
{
/* x == -Inf. According to ISO this is NaN. */
*signgamp = 0;
return x - x;
}
- if ((es & 0x7fff) == 0x7fff && ((hx & 0x7fffffff) | lx) != 0)
+ if (__builtin_expect ((es & 0x7fff) == 0x7fff, 0)
+ && ((hx & 0x7fffffff) | lx) != 0)
{
/* NaN, return it. */
*signgamp = 0;
return x;
}
- if ((es & 0x8000) != 0 && x < 0xffffffff && __rintl (x) == x)
+ if (__builtin_expect ((es & 0x8000) != 0, 0)
+ && x < 0xffffffff && __rintl (x) == x)
{
/* Return value for integer x < 0 is NaN with invalid exception. */
*signgamp = 0;
@@ -60,3 +62,4 @@ __ieee754_gammal_r (long double x, int *signgamp)
/* XXX FIXME. */
return __ieee754_expl (__ieee754_lgammal_r (x, signgamp));
}
+strong_alias (__ieee754_gammal_r, __gammal_r_finite)
diff --git a/sysdeps/ieee754/ldbl-96/e_hypotl.c b/sysdeps/ieee754/ldbl-96/e_hypotl.c
index 1a40c556dc..a59320b067 100644
--- a/sysdeps/ieee754/ldbl-96/e_hypotl.c
+++ b/sysdeps/ieee754/ldbl-96/e_hypotl.c
@@ -14,10 +14,6 @@
* ====================================================
*/
-#if defined(LIBM_SCCS) && !defined(lint)
-static char rcsid[] = "$NetBSD: $";
-#endif
-
/* __ieee754_hypotl(x,y)
*
* Method :
@@ -46,8 +42,8 @@ static char rcsid[] = "$NetBSD: $";
* hypot(x,y) is NAN if x or y is NAN.
*
* Accuracy:
- * hypot(x,y) returns sqrt(x^2+y^2) with error less
- * than 1 ulps (units in the last place)
+ * hypot(x,y) returns sqrt(x^2+y^2) with error less
+ * than 1 ulps (units in the last place)
*/
#include "math.h"
@@ -72,7 +68,7 @@ static char rcsid[] = "$NetBSD: $";
SET_LDOUBLE_EXP(b,eb); /* b <- |b| */
if((ea-eb)>0x46) {return a+b;} /* x/y > 2**70 */
k=0;
- if(ea > 0x5f3f) { /* a>2**8000 */
+ if(__builtin_expect(ea > 0x5f3f,0)) { /* a>2**8000 */
if(ea == 0x7fff) { /* Inf or NaN */
u_int32_t exp,high,low;
w = a+b; /* for sNaN */
@@ -87,9 +83,9 @@ static char rcsid[] = "$NetBSD: $";
SET_LDOUBLE_EXP(a,ea);
SET_LDOUBLE_EXP(b,eb);
}
- if(eb < 0x20bf) { /* b < 2**-8000 */
+ if(__builtin_expect(eb < 0x20bf, 0)) { /* b < 2**-8000 */
if(eb == 0) { /* subnormal b or 0 */
- u_int32_t exp,high,low;
+ u_int32_t exp,high,low;
GET_LDOUBLE_WORDS(exp,high,low,b);
if((high|low)==0) return a;
SET_LDOUBLE_WORDS(t1, 0x7ffd, 0, 0); /* t1=2^16382 */
@@ -97,7 +93,7 @@ static char rcsid[] = "$NetBSD: $";
a *= t1;
k -= 16382;
} else { /* scale a and b by 2^9600 */
- ea += 0x2580; /* a *= 2^9600 */
+ ea += 0x2580; /* a *= 2^9600 */
eb += 0x2580; /* b *= 2^9600 */
k -= 9600;
SET_LDOUBLE_EXP(a,ea);
@@ -131,3 +127,4 @@ static char rcsid[] = "$NetBSD: $";
return t1*w;
} else return w;
}
+strong_alias (__ieee754_hypotl, __hypotl_finite)
diff --git a/sysdeps/ieee754/ldbl-96/e_j0l.c b/sysdeps/ieee754/ldbl-96/e_j0l.c
index 12c906bcbc..ce1f0f7563 100644
--- a/sysdeps/ieee754/ldbl-96/e_j0l.c
+++ b/sysdeps/ieee754/ldbl-96/e_j0l.c
@@ -11,9 +11,9 @@
/* Long double expansions are
Copyright (C) 2001 Stephen L. Moshier <moshier@na-net.ornl.gov>
- and are incorporated herein by permission of the author. The author
+ and are incorporated herein by permission of the author. The author
reserves the right to distribute this material elsewhere under different
- copying permissions. These modifications are distributed here under
+ copying permissions. These modifications are distributed here under
the following terms:
This library is free software; you can redistribute it and/or
@@ -74,17 +74,9 @@
#include "math.h"
#include "math_private.h"
-#ifdef __STDC__
static long double pzero (long double), qzero (long double);
-#else
-static long double pzero (), qzero ();
-#endif
-#ifdef __STDC__
static const long double
-#else
-static long double
-#endif
huge = 1e4930L,
one = 1.0L,
invsqrtpi = 5.6418958354775628694807945156077258584405e-1L,
@@ -109,20 +101,10 @@ static long double
/* 1.000000000000000000000000000000000000000E0L,*/
};
-#ifdef __STDC__
static const long double zero = 0.0;
-#else
-static long double zero = 0.0;
-#endif
-#ifdef __STDC__
long double
__ieee754_j0l (long double x)
-#else
-long double
-__ieee754_j0l (x)
- long double x;
-#endif
{
long double z, s, c, ss, cc, r, u, v;
int32_t ix;
@@ -130,7 +112,7 @@ __ieee754_j0l (x)
GET_LDOUBLE_WORDS (se, i0, i1, x);
ix = se & 0x7fff;
- if (ix >= 0x7fff)
+ if (__builtin_expect (ix >= 0x7fff, 0))
return one / (x * x);
x = fabsl (x);
if (ix >= 0x4000) /* |x| >= 2.0 */
@@ -150,7 +132,7 @@ __ieee754_j0l (x)
* j0(x) = 1/sqrt(pi) * (P(0,x)*cc - Q(0,x)*ss) / sqrt(x)
* y0(x) = 1/sqrt(pi) * (P(0,x)*ss + Q(0,x)*cc) / sqrt(x)
*/
- if (ix > 0x4080) /* 2^129 */
+ if (__builtin_expect (ix > 0x4080, 0)) /* 2^129 */
z = (invsqrtpi * cc) / __ieee754_sqrtl (x);
else
{
@@ -160,7 +142,7 @@ __ieee754_j0l (x)
}
return z;
}
- if (ix < 0x3fef) /* |x| < 2**-16 */
+ if (__builtin_expect (ix < 0x3fef, 0)) /* |x| < 2**-16 */
{
if (huge + x > one)
{ /* raise inexact if x != 0 */
@@ -183,16 +165,13 @@ __ieee754_j0l (x)
return ((one + u) * (one - u) + z * (r / s));
}
}
+strong_alias (__ieee754_j0l, __j0l_finite)
/* y0(x) = 2/pi ln(x) J0(x) + U(x^2)/V(x^2)
0 < x <= 2
peak relative error 1.7e-21 */
-#ifdef __STDC__
static const long double
-#else
-static long double
-#endif
U[6] = {
-1.054912306975785573710813351985351350861E10L,
2.520192609749295139432773849576523636127E10L,
@@ -201,11 +180,7 @@ U[6] = {
-3.440684087134286610316661166492641011539E5L,
1.005524356159130626192144663414848383774E3L,
};
-#ifdef __STDC__
static const long double
-#else
-static long double
-#endif
V[5] = {
1.429337283720789610137291929228082613676E11L,
2.492593075325119157558811370165695013002E9L,
@@ -215,14 +190,8 @@ V[5] = {
/* 1.000000000000000000000000000000000000000E0L */
};
-#ifdef __STDC__
long double
__ieee754_y0l (long double x)
-#else
-long double
-__ieee754_y0l (x)
- long double x;
-#endif
{
long double z, s, c, ss, cc, u, v;
int32_t ix;
@@ -231,11 +200,11 @@ __ieee754_y0l (x)
GET_LDOUBLE_WORDS (se, i0, i1, x);
ix = se & 0x7fff;
/* Y0(NaN) is NaN, y0(-inf) is Nan, y0(inf) is 0 */
- if (se & 0x8000)
+ if (__builtin_expect (se & 0x8000, 0))
return zero / (zero * x);
- if (ix >= 0x7fff)
+ if (__builtin_expect (ix >= 0x7fff, 0))
return one / (x + x * x);
- if ((i0 | i1) == 0)
+ if (__builtin_expect ((i0 | i1) == 0, 0))
return -HUGE_VALL + x; /* -inf and overflow exception. */
if (ix >= 0x4000)
{ /* |x| >= 2.0 */
@@ -266,7 +235,7 @@ __ieee754_y0l (x)
else
ss = z / cc;
}
- if (ix > 0x4080) /* 1e39 */
+ if (__builtin_expect (ix > 0x4080, 0)) /* 1e39 */
z = (invsqrtpi * ss) / __ieee754_sqrtl (x);
else
{
@@ -276,7 +245,7 @@ __ieee754_y0l (x)
}
return z;
}
- if (ix <= 0x3fde) /* x < 2^-33 */
+ if (__builtin_expect (ix <= 0x3fde, 0)) /* x < 2^-33 */
{
z = -7.380429510868722527629822444004602747322E-2L
+ tpi * __ieee754_logl (x);
@@ -287,17 +256,14 @@ __ieee754_y0l (x)
v = V[0] + z * (V[1] + z * (V[2] + z * (V[3] + z * (V[4] + z))));
return (u / v + tpi * (__ieee754_j0l (x) * __ieee754_logl (x)));
}
+strong_alias (__ieee754_y0l, __y0l_finite)
/* The asymptotic expansions of pzero is
* 1 - 9/128 s^2 + 11025/98304 s^4 - ..., where s = 1/x.
* For x >= 2, We approximate pzero by
* pzero(x) = 1 + s^2 R(s^2) / S(s^2)
*/
-#ifdef __STDC__
static const long double pR8[7] = {
-#else
-static long double pR8[7] = {
-#endif
/* 8 <= x <= inf
Peak relative error 4.62 */
-4.094398895124198016684337960227780260127E-9L,
@@ -308,11 +274,7 @@ static long double pR8[7] = {
-5.827178869301452892963280214772398135283E-2L,
-2.087563267939546435460286895807046616992E-2L,
};
-#ifdef __STDC__
static const long double pS8[6] = {
-#else
-static long double pS8[6] = {
-#endif
5.823145095287749230197031108839653988393E-8L,
1.279281986035060320477759999428992730280E-5L,
9.132668954726626677174825517150228961304E-4L,
@@ -322,11 +284,7 @@ static long double pS8[6] = {
/* 1.000000000000000000000000000000000000000E0L, */
};
-#ifdef __STDC__
static const long double pR5[7] = {
-#else
-static long double pR5[7] = {
-#endif
/* 4.54541015625 <= x <= 8
Peak relative error 6.51E-22 */
-2.041226787870240954326915847282179737987E-7L,
@@ -337,11 +295,7 @@ static long double pR5[7] = {
-8.641175552716402616180994954177818461588E-2L,
-1.354654710097134007437166939230619726157E-2L,
};
-#ifdef __STDC__
static const long double pS5[6] = {
-#else
-static long double pS5[6] = {
-#endif
2.903078099681108697057258628212823545290E-6L,
3.253948449946735405975737677123673867321E-4L,
1.181269751723085006534147920481582279979E-2L,
@@ -351,11 +305,7 @@ static long double pS5[6] = {
/* 1.000000000000000000000000000000000000000E0L, */
};
-#ifdef __STDC__
static const long double pR3[7] = {
-#else
-static long double pR3[7] = {
-#endif
/* 2.85711669921875 <= x <= 4.54541015625
peak relative error 5.25e-21 */
-5.755732156848468345557663552240816066802E-6L,
@@ -366,11 +316,7 @@ static long double pR3[7] = {
-1.193350853469302941921647487062620011042E-1L,
-8.567802507331578894302991505331963782905E-3L,
};
-#ifdef __STDC__
static const long double pS3[6] = {
-#else
-static long double pS3[6] = {
-#endif
8.185931139070086158103309281525036712419E-5L,
5.398016943778891093520574483111255476787E-3L,
1.130589193590489566669164765853409621081E-1L,
@@ -380,11 +326,7 @@ static long double pS3[6] = {
/* 1.000000000000000000000000000000000000000E0L, */
};
-#ifdef __STDC__
static const long double pR2[7] = {
-#else
-static long double pR2[7] = {
-#endif
/* 2 <= x <= 2.85711669921875
peak relative error 2.64e-21 */
-1.219525235804532014243621104365384992623E-4L,
@@ -395,11 +337,7 @@ static long double pR2[7] = {
-1.556241316844728872406672349347137975495E-1L,
-5.355423239526452209595316733635519506958E-3L,
};
-#ifdef __STDC__
static const long double pS2[6] = {
-#else
-static long double pS2[6] = {
-#endif
1.734442793664291412489066256138894953823E-3L,
7.158111826468626405416300895617986926008E-2L,
9.153839713992138340197264669867993552641E-1L,
@@ -409,20 +347,10 @@ static long double pS2[6] = {
/* 1.000000000000000000000000000000000000000E0L, */
};
-#ifdef __STDC__
static long double
pzero (long double x)
-#else
-static long double
-pzero (x)
- long double x;
-#endif
{
-#ifdef __STDC__
const long double *p, *q;
-#else
- long double *p, *q;
-#endif
long double z, r, s;
int32_t ix;
u_int32_t se, i0, i1;
@@ -468,11 +396,7 @@ pzero (x)
* We approximate qzero by
* qzero(x) = s*(-.125 + R(s^2) / S(s^2))
*/
-#ifdef __STDC__
static const long double qR8[7] = {
-#else
-static long double qR8[7] = {
-#endif
/* 8 <= x <= inf
peak relative error 2.23e-21 */
3.001267180483191397885272640777189348008E-10L,
@@ -483,11 +407,7 @@ static long double qR8[7] = {
3.881970028476167836382607922840452192636E-2L,
6.132191514516237371140841765561219149638E-2L,
};
-#ifdef __STDC__
static const long double qS8[7] = {
-#else
-static long double qS8[7] = {
-#endif
4.097730123753051126914971174076227600212E-9L,
1.199615869122646109596153392152131139306E-6L,
1.196337580514532207793107149088168946451E-4L,
@@ -498,11 +418,7 @@ static long double qS8[7] = {
/* 1.000000000000000000000000000000000000000E0L, */
};
-#ifdef __STDC__
static const long double qR5[7] = {
-#else
-static long double qR5[7] = {
-#endif
/* 4.54541015625 <= x <= 8
peak relative error 1.03e-21 */
3.406256556438974327309660241748106352137E-8L,
@@ -513,11 +429,7 @@ static long double qR5[7] = {
1.071578819056574524416060138514508609805E-1L,
7.458950172851611673015774675225656063757E-2L,
};
-#ifdef __STDC__
static const long double qS5[7] = {
-#else
-static long double qS5[7] = {
-#endif
4.650675622764245276538207123618745150785E-7L,
6.773573292521412265840260065635377164455E-5L,
3.340711249876192721980146877577806687714E-3L,
@@ -528,11 +440,7 @@ static long double qS5[7] = {
/* 1.000000000000000000000000000000000000000E0L,*/
};
-#ifdef __STDC__
static const long double qR3[7] = {
-#else
-static long double qR3[7] = {
-#endif
/* 2.85711669921875 <= x <= 4.54541015625
peak relative error 5.24e-21 */
1.749459596550816915639829017724249805242E-6L,
@@ -543,11 +451,7 @@ static long double qR3[7] = {
2.538595333972857367655146949093055405072E-1L,
8.560591367256769038905328596020118877936E-2L,
};
-#ifdef __STDC__
static const long double qS3[7] = {
-#else
-static long double qS3[7] = {
-#endif
2.388596091707517488372313710647510488042E-5L,
2.048679968058758616370095132104333998147E-3L,
5.824663198201417760864458765259945181513E-2L,
@@ -558,11 +462,7 @@ static long double qS3[7] = {
/* 1.000000000000000000000000000000000000000E0L, */
};
-#ifdef __STDC__
static const long double qR2[7] = {
-#else
-static long double qR2[7] = {
-#endif
/* 2 <= x <= 2.85711669921875
peak relative error 1.58e-21 */
6.306524405520048545426928892276696949540E-5L,
@@ -573,11 +473,7 @@ static long double qR2[7] = {
5.431871999743531634887107835372232030655E-1L,
9.447736151202905471899259026430157211949E-2L,
};
-#ifdef __STDC__
static const long double qS2[7] = {
-#else
-static long double qS2[7] = {
-#endif
8.610579901936193494609755345106129102676E-4L,
4.649054352710496997203474853066665869047E-2L,
8.104282924459837407218042945106320388339E-1L,
@@ -588,20 +484,10 @@ static long double qS2[7] = {
/* 1.000000000000000000000000000000000000000E0L, */
};
-#ifdef __STDC__
static long double
qzero (long double x)
-#else
-static long double
-qzero (x)
- long double x;
-#endif
{
-#ifdef __STDC__
const long double *p, *q;
-#else
- long double *p, *q;
-#endif
long double s, r, z;
int32_t ix;
u_int32_t se, i0, i1;
diff --git a/sysdeps/ieee754/ldbl-96/e_j1l.c b/sysdeps/ieee754/ldbl-96/e_j1l.c
index 62a8ce0cb7..369fd830fe 100644
--- a/sysdeps/ieee754/ldbl-96/e_j1l.c
+++ b/sysdeps/ieee754/ldbl-96/e_j1l.c
@@ -11,9 +11,9 @@
/* Long double expansions are
Copyright (C) 2001 Stephen L. Moshier <moshier@na-net.ornl.gov>
- and are incorporated herein by permission of the author. The author
+ and are incorporated herein by permission of the author. The author
reserves the right to distribute this material elsewhere under different
- copying permissions. These modifications are distributed here under
+ copying permissions. These modifications are distributed here under
the following terms:
This library is free software; you can redistribute it and/or
@@ -38,17 +38,17 @@
* for x in (0,2)
* j1(x) = x/2 + x*z*R0/S0, where z = x*x;
* for x in (2,inf)
- * j1(x) = sqrt(2/(pi*x))*(p1(x)*cos(x1)-q1(x)*sin(x1))
- * y1(x) = sqrt(2/(pi*x))*(p1(x)*sin(x1)+q1(x)*cos(x1))
- * where x1 = x-3*pi/4. It is better to compute sin(x1),cos(x1)
+ * j1(x) = sqrt(2/(pi*x))*(p1(x)*cos(x1)-q1(x)*sin(x1))
+ * y1(x) = sqrt(2/(pi*x))*(p1(x)*sin(x1)+q1(x)*cos(x1))
+ * where x1 = x-3*pi/4. It is better to compute sin(x1),cos(x1)
* as follow:
* cos(x1) = cos(x)cos(3pi/4)+sin(x)sin(3pi/4)
* = 1/sqrt(2) * (sin(x) - cos(x))
* sin(x1) = sin(x)cos(3pi/4)-cos(x)sin(3pi/4)
* = -1/sqrt(2) * (sin(x) + cos(x))
- * (To avoid cancellation, use
+ * (To avoid cancellation, use
* sin(x) +- cos(x) = -cos(2x)/(sin(x) -+ cos(x))
- * to compute the worse one.)
+ * to compute the worse one.)
*
* 3 Special cases
* j1(nan)= nan
@@ -66,25 +66,17 @@
* Note: For tiny x, 1/x dominate y1 and hence
* y1(tiny) = -2/pi/tiny
* 3. For x>=2.
- * y1(x) = sqrt(2/(pi*x))*(p1(x)*sin(x1)+q1(x)*cos(x1))
- * where x1 = x-3*pi/4. It is better to compute sin(x1),cos(x1)
+ * y1(x) = sqrt(2/(pi*x))*(p1(x)*sin(x1)+q1(x)*cos(x1))
+ * where x1 = x-3*pi/4. It is better to compute sin(x1),cos(x1)
* by method mentioned above.
*/
#include "math.h"
#include "math_private.h"
-#ifdef __STDC__
static long double pone (long double), qone (long double);
-#else
-static long double pone (), qone ();
-#endif
-#ifdef __STDC__
static const long double
-#else
-static long double
-#endif
huge = 1e4930L,
one = 1.0L,
invsqrtpi = 5.6418958354775628694807945156077258584405e-1L,
@@ -110,21 +102,11 @@ R[5] = {
/* 1.000000000000000000000000000000000000000E0L, */
};
-#ifdef __STDC__
static const long double zero = 0.0;
-#else
-static long double zero = 0.0;
-#endif
-#ifdef __STDC__
long double
__ieee754_j1l (long double x)
-#else
-long double
-__ieee754_j1l (x)
- long double x;
-#endif
{
long double z, c, r, s, ss, cc, u, v, y;
int32_t ix;
@@ -132,7 +114,7 @@ __ieee754_j1l (x)
GET_LDOUBLE_WORDS (se, i0, i1, x);
ix = se & 0x7fff;
- if (ix >= 0x7fff)
+ if (__builtin_expect (ix >= 0x7fff, 0))
return one / x;
y = fabsl (x);
if (ix >= 0x4000)
@@ -152,7 +134,7 @@ __ieee754_j1l (x)
* j1(x) = 1/sqrt(pi) * (P(1,x)*cc - Q(1,x)*ss) / sqrt(x)
* y1(x) = 1/sqrt(pi) * (P(1,x)*ss + Q(1,x)*cc) / sqrt(x)
*/
- if (ix > 0x4080)
+ if (__builtin_expect (ix > 0x4080, 0))
z = (invsqrtpi * cc) / __ieee754_sqrtl (y);
else
{
@@ -165,7 +147,7 @@ __ieee754_j1l (x)
else
return z;
}
- if (ix < 0x3fde) /* |x| < 2^-33 */
+ if (__builtin_expect (ix < 0x3fde, 0)) /* |x| < 2^-33 */
{
if (huge + x > one)
return 0.5 * x; /* inexact if x!=0 necessary */
@@ -176,16 +158,13 @@ __ieee754_j1l (x)
r *= x;
return (x * 0.5 + r / s);
}
+strong_alias (__ieee754_j1l, __j1l_finite)
/* Y1(x) = 2/pi * (log(x) * j1(x) - 1/x) + x R(x^2)
0 <= x <= 2
Peak relative error 2.3e-23 */
-#ifdef __STDC__
static const long double U0[6] = {
-#else
-static long double U0[6] = {
-#endif
-5.908077186259914699178903164682444848615E10L,
1.546219327181478013495975514375773435962E10L,
-6.438303331169223128870035584107053228235E8L,
@@ -193,11 +172,7 @@ static long double U0[6] = {
-6.138043997084355564619377183564196265471E4L,
1.418503228220927321096904291501161800215E2L,
};
-#ifdef __STDC__
static const long double V0[5] = {
-#else
-static long double V0[5] = {
-#endif
3.013447341682896694781964795373783679861E11L,
4.669546565705981649470005402243136124523E9L,
3.595056091631351184676890179233695857260E7L,
@@ -207,14 +182,8 @@ static long double V0[5] = {
};
-#ifdef __STDC__
long double
__ieee754_y1l (long double x)
-#else
-long double
-__ieee754_y1l (x)
- long double x;
-#endif
{
long double z, s, c, ss, cc, u, v;
int32_t ix;
@@ -223,11 +192,11 @@ __ieee754_y1l (x)
GET_LDOUBLE_WORDS (se, i0, i1, x);
ix = se & 0x7fff;
/* if Y1(NaN) is NaN, Y1(-inf) is NaN, Y1(inf) is 0 */
- if (se & 0x8000)
+ if (__builtin_expect (se & 0x8000, 0))
return zero / (zero * x);
- if (ix >= 0x7fff)
+ if (__builtin_expect (ix >= 0x7fff, 0))
return one / (x + x * x);
- if ((i0 | i1) == 0)
+ if (__builtin_expect ((i0 | i1) == 0, 0))
return -HUGE_VALL + x; /* -inf and overflow exception. */
if (ix >= 0x4000)
{ /* |x| >= 2.0 */
@@ -253,7 +222,7 @@ __ieee754_y1l (x)
* sin(x) +- cos(x) = -cos(2x)/(sin(x) -+ cos(x))
* to compute the worse one.
*/
- if (ix > 0x4080)
+ if (__builtin_expect (ix > 0x4080, 0))
z = (invsqrtpi * ss) / __ieee754_sqrtl (x);
else
{
@@ -263,7 +232,7 @@ __ieee754_y1l (x)
}
return z;
}
- if (ix <= 0x3fbe)
+ if (__builtin_expect (ix <= 0x3fbe, 0))
{ /* x < 2**-65 */
return (-tpi / x);
}
@@ -273,12 +242,13 @@ __ieee754_y1l (x)
return (x * (u / v) +
tpi * (__ieee754_j1l (x) * __ieee754_logl (x) - one / x));
}
+strong_alias (__ieee754_y1l, __y1l_finite)
/* For x >= 8, the asymptotic expansions of pone is
* 1 + 15/128 s^2 - 4725/2^15 s^4 - ..., where s = 1/x.
* We approximate pone by
- * pone(x) = 1 + (R/S)
+ * pone(x) = 1 + (R/S)
*/
/* J1(x) cosX + Y1(x) sinX = sqrt( 2/(pi x)) P1(x)
@@ -286,11 +256,7 @@ __ieee754_y1l (x)
8 <= x <= inf (0 <= z <= 0.125)
Peak relative error 5.2e-22 */
-#ifdef __STDC__
static const long double pr8[7] = {
-#else
-static long double pr8[7] = {
-#endif
8.402048819032978959298664869941375143163E-9L,
1.813743245316438056192649247507255996036E-6L,
1.260704554112906152344932388588243836276E-4L,
@@ -299,11 +265,7 @@ static long double pr8[7] = {
1.131111483254318243139953003461511308672E-1L,
4.480715825681029711521286449131671880953E-2L,
};
-#ifdef __STDC__
static const long double ps8[6] = {
-#else
-static long double ps8[6] = {
-#endif
7.169748325574809484893888315707824924354E-8L,
1.556549720596672576431813934184403614817E-5L,
1.094540125521337139209062035774174565882E-3L,
@@ -317,11 +279,7 @@ static long double ps8[6] = {
P1(x) = 1 + z^2 R(z^2), z=1/x
4.54541015625 <= x <= 8
Peak relative error 7.7e-22 */
-#ifdef __STDC__
static const long double pr5[7] = {
-#else
-static long double pr5[7] = {
-#endif
4.318486887948814529950980396300969247900E-7L,
4.715341880798817230333360497524173929315E-5L,
1.642719430496086618401091544113220340094E-3L,
@@ -330,11 +288,7 @@ static long double pr5[7] = {
1.755576530055079253910829652698703791957E-1L,
3.218803858282095929559165965353784980613E-2L,
};
-#ifdef __STDC__
static const long double ps5[6] = {
-#else
-static long double ps5[6] = {
-#endif
3.685108812227721334719884358034713967557E-6L,
4.069102509511177498808856515005792027639E-4L,
1.449728676496155025507893322405597039816E-2L,
@@ -348,11 +302,7 @@ static long double ps5[6] = {
P1(x) = 1 + z^2 R(z^2), z=1/x
2.85711669921875 <= x <= 4.54541015625
Peak relative error 6.5e-21 */
-#ifdef __STDC__
static const long double pr3[7] = {
-#else
-static long double pr3[7] = {
-#endif
1.265251153957366716825382654273326407972E-5L,
8.031057269201324914127680782288352574567E-4L,
1.581648121115028333661412169396282881035E-2L,
@@ -361,11 +311,7 @@ static long double pr3[7] = {
2.559223765418386621748404398017602935764E-1L,
2.277136933287817911091370397134882441046E-2L,
};
-#ifdef __STDC__
static const long double ps3[6] = {
-#else
-static long double ps3[6] = {
-#endif
1.079681071833391818661952793568345057548E-4L,
6.986017817100477138417481463810841529026E-3L,
1.429403701146942509913198539100230540503E-1L,
@@ -379,11 +325,7 @@ static long double ps3[6] = {
P1(x) = 1 + z^2 R(z^2), z=1/x
2 <= x <= 2.85711669921875
Peak relative error 3.5e-21 */
-#ifdef __STDC__
static const long double pr2[7] = {
-#else
-static long double pr2[7] = {
-#endif
2.795623248568412225239401141338714516445E-4L,
1.092578168441856711925254839815430061135E-2L,
1.278024620468953761154963591853679640560E-1L,
@@ -392,11 +334,7 @@ static long double pr2[7] = {
3.544176317308370086415403567097130611468E-1L,
1.604142674802373041247957048801599740644E-2L,
};
-#ifdef __STDC__
static const long double ps2[6] = {
-#else
-static long double ps2[6] = {
-#endif
2.385605161555183386205027000675875235980E-3L,
9.616778294482695283928617708206967248579E-2L,
1.195215570959693572089824415393951258510E0L,
@@ -407,20 +345,10 @@ static long double ps2[6] = {
};
-#ifdef __STDC__
static long double
pone (long double x)
-#else
-static long double
-pone (x)
- long double x;
-#endif
{
-#ifdef __STDC__
const long double *p, *q;
-#else
- long double *p, *q;
-#endif
long double z, r, s;
int32_t ix;
u_int32_t se, i0, i1;
@@ -462,7 +390,7 @@ pone (x)
/* For x >= 8, the asymptotic expansions of qone is
* 3/8 s - 105/1024 s^3 - ..., where s = 1/x.
* We approximate pone by
- * qone(x) = s*(0.375 + (R/S))
+ * qone(x) = s*(0.375 + (R/S))
*/
/* Y1(x)cosX - J1(x)sinX = sqrt( 2/(pi x)) Q1(x),
@@ -470,11 +398,7 @@ pone (x)
8 <= x <= inf
Peak relative error 8.3e-22 */
-#ifdef __STDC__
static const long double qr8[7] = {
-#else
-static long double qr8[7] = {
-#endif
-5.691925079044209246015366919809404457380E-10L,
-1.632587664706999307871963065396218379137E-7L,
-1.577424682764651970003637263552027114600E-5L,
@@ -483,11 +407,7 @@ static long double qr8[7] = {
-6.854943629378084419631926076882330494217E-2L,
-1.055448290469180032312893377152490183203E-1L,
};
-#ifdef __STDC__
static const long double qs8[7] = {
-#else
-static long double qs8[7] = {
-#endif
5.550982172325019811119223916998393907513E-9L,
1.607188366646736068460131091130644192244E-6L,
1.580792530091386496626494138334505893599E-4L,
@@ -502,11 +422,7 @@ static long double qs8[7] = {
Q1(x) = z(.375 + z^2 R(z^2)), z=1/x
4.54541015625 <= x <= 8
Peak relative error 4.1e-22 */
-#ifdef __STDC__
static const long double qr5[7] = {
-#else
-static long double qr5[7] = {
-#endif
-6.719134139179190546324213696633564965983E-8L,
-9.467871458774950479909851595678622044140E-6L,
-4.429341875348286176950914275723051452838E-4L,
@@ -515,11 +431,7 @@ static long double qr5[7] = {
-1.964432669771684034858848142418228214855E-1L,
-1.333896496989238600119596538299938520726E-1L,
};
-#ifdef __STDC__
static const long double qs5[7] = {
-#else
-static long double qs5[7] = {
-#endif
6.552755584474634766937589285426911075101E-7L,
9.410814032118155978663509073200494000589E-5L,
4.561677087286518359461609153655021253238E-3L,
@@ -534,11 +446,7 @@ static long double qs5[7] = {
Q1(x) = z(.375 + z^2 R(z^2)), z=1/x
2.85711669921875 <= x <= 4.54541015625
Peak relative error 2.2e-21 */
-#ifdef __STDC__
static const long double qr3[7] = {
-#else
-static long double qr3[7] = {
-#endif
-3.618746299358445926506719188614570588404E-6L,
-2.951146018465419674063882650970344502798E-4L,
-7.728518171262562194043409753656506795258E-3L,
@@ -547,11 +455,7 @@ static long double qr3[7] = {
-4.858192581793118040782557808823460276452E-1L,
-1.592399251246473643510898335746432479373E-1L,
};
-#ifdef __STDC__
static const long double qs3[7] = {
-#else
-static long double qs3[7] = {
-#endif
3.529139957987837084554591421329876744262E-5L,
2.973602667215766676998703687065066180115E-3L,
8.273534546240864308494062287908662592100E-2L,
@@ -566,11 +470,7 @@ static long double qs3[7] = {
Q1(x) = z(.375 + z^2 R(z^2)), z=1/x
2 <= x <= 2.85711669921875
Peak relative error 6.9e-22 */
-#ifdef __STDC__
static const long double qr2[7] = {
-#else
-static long double qr2[7] = {
-#endif
-1.372751603025230017220666013816502528318E-4L,
-6.879190253347766576229143006767218972834E-3L,
-1.061253572090925414598304855316280077828E-1L,
@@ -579,11 +479,7 @@ static long double qr2[7] = {
-1.087955310491078933531734062917489870754E0L,
-1.826821119773182847861406108689273719137E-1L,
};
-#ifdef __STDC__
static const long double qs2[7] = {
-#else
-static long double qs2[7] = {
-#endif
1.338768933634451601814048220627185324007E-3L,
7.071099998918497559736318523932241901810E-2L,
1.200511429784048632105295629933382142221E0L,
@@ -595,20 +491,10 @@ static long double qs2[7] = {
};
-#ifdef __STDC__
static long double
qone (long double x)
-#else
-static long double
-qone (x)
- long double x;
-#endif
{
-#ifdef __STDC__
const long double *p, *q;
-#else
- long double *p, *q;
-#endif
static long double s, r, z;
int32_t ix;
u_int32_t se, i0, i1;
diff --git a/sysdeps/ieee754/ldbl-96/e_jnl.c b/sysdeps/ieee754/ldbl-96/e_jnl.c
index bedff7d566..3a70e10dbe 100644
--- a/sysdeps/ieee754/ldbl-96/e_jnl.c
+++ b/sysdeps/ieee754/ldbl-96/e_jnl.c
@@ -11,9 +11,9 @@
/* Modifications for long double are
Copyright (C) 2001 Stephen L. Moshier <moshier@na-net.ornl.gov>
- and are incorporated herein by permission of the author. The author
+ and are incorporated herein by permission of the author. The author
reserves the right to distribute this material elsewhere under different
- copying permissions. These modifications are distributed here under
+ copying permissions. These modifications are distributed here under
the following terms:
This library is free software; you can redistribute it and/or
@@ -59,28 +59,13 @@
#include "math.h"
#include "math_private.h"
-#ifdef __STDC__
static const long double
-#else
-static long double
-#endif
invsqrtpi = 5.64189583547756286948079e-1L, two = 2.0e0L, one = 1.0e0L;
-#ifdef __STDC__
static const long double zero = 0.0L;
-#else
-static long double zero = 0.0L;
-#endif
-#ifdef __STDC__
long double
__ieee754_jnl (int n, long double x)
-#else
-long double
-__ieee754_jnl (n, x)
- int n;
- long double x;
-#endif
{
u_int32_t se, i0, i1;
int32_t i, ix, sgn;
@@ -95,7 +80,7 @@ __ieee754_jnl (n, x)
ix = se & 0x7fff;
/* if J(n,NaN) is NaN */
- if ((ix == 0x7fff) && ((i0 & 0x7fffffff) != 0))
+ if (__builtin_expect ((ix == 0x7fff) && ((i0 & 0x7fffffff) != 0), 0))
return x + x;
if (n < 0)
{
@@ -109,7 +94,8 @@ __ieee754_jnl (n, x)
return (__ieee754_j1l (x));
sgn = (n & 1) & (se >> 15); /* even n -- 0, odd n -- sign(x) */
x = fabsl (x);
- if ((ix | i0 | i1) == 0 || ix >= 0x7fff) /* if x is 0 or inf */
+ if (__builtin_expect ((ix | i0 | i1) == 0 || ix >= 0x7fff, 0))
+ /* if x is 0 or inf */
b = zero;
else if ((long double) n <= x)
{
@@ -298,16 +284,10 @@ __ieee754_jnl (n, x)
else
return b;
}
+strong_alias (__ieee754_jnl, __jnl_finite)
-#ifdef __STDC__
long double
__ieee754_ynl (int n, long double x)
-#else
-long double
-__ieee754_ynl (n, x)
- int n;
- long double x;
-#endif
{
u_int32_t se, i0, i1;
int32_t i, ix;
@@ -318,11 +298,11 @@ __ieee754_ynl (n, x)
GET_LDOUBLE_WORDS (se, i0, i1, x);
ix = se & 0x7fff;
/* if Y(n,NaN) is NaN */
- if ((ix == 0x7fff) && ((i0 & 0x7fffffff) != 0))
+ if (__builtin_expect ((ix == 0x7fff) && ((i0 & 0x7fffffff) != 0), 0))
return x + x;
- if ((ix | i0 | i1) == 0)
+ if (__builtin_expect ((ix | i0 | i1) == 0, 0))
return -HUGE_VALL + x; /* -inf and overflow exception. */
- if (se & 0x8000)
+ if (__builtin_expect (se & 0x8000, 0))
return zero / (zero * x);
sign = 1;
if (n < 0)
@@ -334,7 +314,7 @@ __ieee754_ynl (n, x)
return (__ieee754_y0l (x));
if (n == 1)
return (sign * __ieee754_y1l (x));
- if (ix == 0x7fff)
+ if (__builtin_expect (ix == 0x7fff, 0))
return zero;
if (ix >= 0x412D)
{ /* x > 2**302 */
@@ -393,3 +373,4 @@ __ieee754_ynl (n, x)
else
return -b;
}
+strong_alias (__ieee754_ynl, __ynl_finite)
diff --git a/sysdeps/ieee754/ldbl-96/e_lgammal_r.c b/sysdeps/ieee754/ldbl-96/e_lgammal_r.c
index 36e336565c..8a20e5e135 100644
--- a/sysdeps/ieee754/ldbl-96/e_lgammal_r.c
+++ b/sysdeps/ieee754/ldbl-96/e_lgammal_r.c
@@ -94,11 +94,7 @@
#include "math.h"
#include "math_private.h"
-#ifdef __STDC__
static const long double
-#else
-static long double
-#endif
half = 0.5L,
one = 1.0L,
pi = 3.14159265358979323846264L,
@@ -204,20 +200,10 @@ static long double
w6 = -1.880801938119376907179E-3L,
w7 = 4.885026142432270781165E-3L;
-#ifdef __STDC__
static const long double zero = 0.0L;
-#else
-static long double zero = 0.0L;
-#endif
-#ifdef __STDC__
static long double
sin_pi (long double x)
-#else
-static long double
-sin_pi (x)
- long double x;
-#endif
{
long double y, z;
int n, ix;
@@ -283,15 +269,8 @@ sin_pi (x)
}
-#ifdef __STDC__
long double
__ieee754_lgammal_r (long double x, int *signgamp)
-#else
-long double
-__ieee754_lgammal_r (x, signgamp)
- long double x;
- int *signgamp;
-#endif
{
long double t, y, z, nadj, p, p1, p2, q, r, w;
int i, ix;
@@ -301,7 +280,7 @@ __ieee754_lgammal_r (x, signgamp)
GET_LDOUBLE_WORDS (se, i0, i1, x);
ix = se & 0x7fff;
- if ((ix | i0 | i1) == 0)
+ if (__builtin_expect((ix | i0 | i1) == 0, 0))
{
if (se & 0x8000)
*signgamp = -1;
@@ -311,10 +290,10 @@ __ieee754_lgammal_r (x, signgamp)
ix = (ix << 16) | (i0 >> 16);
/* purge off +-inf, NaN, +-0, and negative arguments */
- if (ix >= 0x7fff0000)
+ if (__builtin_expect(ix >= 0x7fff0000, 0))
return x * x;
- if (ix < 0x3fc08000) /* 2^-63 */
+ if (__builtin_expect(ix < 0x3fc08000, 0)) /* 2^-63 */
{ /* |x|<2**-63, return -log(|x|) */
if (se & 0x8000)
{
@@ -438,7 +417,7 @@ __ieee754_lgammal_r (x, signgamp)
z = one / x;
y = z * z;
w = w0 + z * (w1
- + y * (w2 + y * (w3 + y * (w4 + y * (w5 + y * (w6 + y * w7))))));
+ + y * (w2 + y * (w3 + y * (w4 + y * (w5 + y * (w6 + y * w7))))));
r = (x - half) * (t - one) + w;
}
else
@@ -448,3 +427,4 @@ __ieee754_lgammal_r (x, signgamp)
r = nadj - r;
return r;
}
+strong_alias (__ieee754_lgammal_r, __lgammal_r_finite)
diff --git a/sysdeps/ieee754/ldbl-96/e_remainderl.c b/sysdeps/ieee754/ldbl-96/e_remainderl.c
index e721a6e8cd..41c4c7b34e 100644
--- a/sysdeps/ieee754/ldbl-96/e_remainderl.c
+++ b/sysdeps/ieee754/ldbl-96/e_remainderl.c
@@ -14,14 +14,10 @@
* ====================================================
*/
-#if defined(LIBM_SCCS) && !defined(lint)
-static char rcsid[] = "$NetBSD: $";
-#endif
-
/* __ieee754_remainderl(x,p)
* Return :
- * returns x REM p = x - [x/p]*p as if in infinite
- * precise arithmetic, where [x/p] is the (infinite bit)
+ * returns x REM p = x - [x/p]*p as if in infinite
+ * precise arithmetic, where [x/p] is the (infinite bit)
* integer nearest x/p (in half way case choose the even one).
* Method :
* Based on fmod() return x-[x/p]chopped*p exactlp.
@@ -30,19 +26,11 @@ static char rcsid[] = "$NetBSD: $";
#include "math.h"
#include "math_private.h"
-#ifdef __STDC__
static const long double zero = 0.0;
-#else
-static long double zero = 0.0;
-#endif
-#ifdef __STDC__
- long double __ieee754_remainderl(long double x, long double p)
-#else
- long double __ieee754_remainderl(x,p)
- long double x,p;
-#endif
+long double
+__ieee754_remainderl(long double x, long double p)
{
u_int32_t sx,sex,sep,x0,x1,p0,p1;
long double p_half;
@@ -54,7 +42,7 @@ static long double zero = 0.0;
sex &= 0x7fff;
/* purge off exception values */
- if((sep|p0|p1)==0) return (x*p)/(x*p); /* p = 0 */
+ if((sep|p0|p1)==0) return (x*p)/(x*p); /* p = 0 */
if((sex==0x7fff)|| /* x not finite */
((sep==0x7fff)&& /* p is NaN */
((p0|p1)!=0)))
@@ -81,3 +69,4 @@ static long double zero = 0.0;
SET_LDOUBLE_EXP(x,sex^sx);
return x;
}
+strong_alias (__ieee754_remainderl, __remainderl_finite)
diff --git a/sysdeps/ieee754/ldbl-96/e_sinhl.c b/sysdeps/ieee754/ldbl-96/e_sinhl.c
index 646d4fde82..8593272406 100644
--- a/sysdeps/ieee754/ldbl-96/e_sinhl.c
+++ b/sysdeps/ieee754/ldbl-96/e_sinhl.c
@@ -23,9 +23,9 @@ static char rcsid[] = "$NetBSD: $";
* mathematically sinh(x) if defined to be (exp(x)-exp(-x))/2
* 1. Replace x by |x| (sinhl(-x) = -sinhl(x)).
* 2.
- * E + E/(E+1)
+ * E + E/(E+1)
* 0 <= x <= 25 : sinhl(x) := --------------, E=expm1l(x)
- * 2
+ * 2
*
* 25 <= x <= lnovft : sinhl(x) := expl(x)/2
* lnovft <= x <= ln2ovft: sinhl(x) := expl(x/2)/2 * expl(x/2)
@@ -39,18 +39,10 @@ static char rcsid[] = "$NetBSD: $";
#include "math.h"
#include "math_private.h"
-#ifdef __STDC__
static const long double one = 1.0, shuge = 1.0e4931L;
-#else
-static long double one = 1.0, shuge = 1.0e4931L;
-#endif
-#ifdef __STDC__
- long double __ieee754_sinhl(long double x)
-#else
- long double __ieee754_sinhl(x)
- long double x;
-#endif
+long double
+__ieee754_sinhl(long double x)
{
long double t,w,h;
u_int32_t jx,ix,i0,i1;
@@ -60,13 +52,13 @@ static long double one = 1.0, shuge = 1.0e4931L;
ix = jx&0x7fff;
/* x is INF or NaN */
- if(ix==0x7fff) return x+x;
+ if(__builtin_expect(ix==0x7fff, 0)) return x+x;
h = 0.5;
if (jx & 0x8000) h = -h;
/* |x| in [0,25], return sign(x)*0.5*(E+E/(E+1))) */
if (ix < 0x4003 || (ix == 0x4003 && i0 <= 0xc8000000)) { /* |x|<25 */
- if (ix<0x3fdf) /* |x|<2**-32 */
+ if (ix<0x3fdf) /* |x|<2**-32 */
if(shuge+x>one) return x;/* sinh(tiny) = tiny with inexact */
t = __expm1l(fabsl(x));
if(ix<0x3fff) return h*(2.0*t-t*t/(t+one));
@@ -89,3 +81,4 @@ static long double one = 1.0, shuge = 1.0e4931L;
/* |x| > overflowthreshold, sinhl(x) overflow */
return x*shuge;
}
+strong_alias (__ieee754_sinhl, __sinhl_finite)
diff --git a/sysdeps/ieee754/ldbl-96/s_asinhl.c b/sysdeps/ieee754/ldbl-96/s_asinhl.c
index 6eb434c44b..9f37d48842 100644
--- a/sysdeps/ieee754/ldbl-96/s_asinhl.c
+++ b/sysdeps/ieee754/ldbl-96/s_asinhl.c
@@ -52,19 +52,21 @@ huge= 1.000000000000000000e+4900L;
int32_t hx,ix;
GET_LDOUBLE_EXP(hx,x);
ix = hx&0x7fff;
- if(ix==0x7fff) return x+x; /* x is inf or NaN */
- if(ix< 0x3fde) { /* |x|<2**-34 */
+ if(__builtin_expect(ix< 0x3fde, 0)) { /* |x|<2**-34 */
if(huge+x>one) return x; /* return x inexact except 0 */
}
- if(ix>0x4020) { /* |x| > 2**34 */
+ if(__builtin_expect(ix>0x4020,0)) { /* |x| > 2**34 */
+ if(ix==0x7fff) return x+x; /* x is inf or NaN */
w = __ieee754_logl(fabsl(x))+ln2;
- } else if (ix>0x4000) { /* 2**34 > |x| > 2.0 */
- t = fabsl(x);
- w = __ieee754_logl(2.0*t+one/(__ieee754_sqrtl(x*x+one)+t));
- } else { /* 2.0 > |x| > 2**-28 */
- t = x*x;
- w =__log1pl(fabsl(x)+t/(one+__ieee754_sqrtl(one+t)));
+ } else {
+ long double xa = fabsl(x);
+ if (ix>0x4000) { /* 2**34 > |x| > 2.0 */
+ w = __ieee754_logl(2.0*xa+one/(__ieee754_sqrtl(xa*xa+one)+xa));
+ } else { /* 2.0 > |x| > 2**-28 */
+ t = xa*xa;
+ w =__log1pl(xa+t/(one+__ieee754_sqrtl(one+t)));
+ }
}
- if(hx&0x8000) return -w; else return w;
+ return __copysignl(w, x);
}
weak_alias (__asinhl, asinhl)