summaryrefslogtreecommitdiff
path: root/libc/sysdeps/ieee754
diff options
context:
space:
mode:
authorjoseph <joseph@7b3dc134-2b1b-0410-93df-9e9f96275f8d>2012-12-02 21:11:45 +0000
committerjoseph <joseph@7b3dc134-2b1b-0410-93df-9e9f96275f8d>2012-12-02 21:11:45 +0000
commit94c459cc7a611211d10773eef526826a8da80456 (patch)
tree68526f35a4f1d891b05436e0233a85c74dcc7eff /libc/sysdeps/ieee754
parent2b19f7c91f9f7c2a7c585cc62b5f3fe75bece1b7 (diff)
Merge changes between r21775 and r21911 from /fsf/trunk.
git-svn-id: svn://svn.eglibc.org/trunk@21912 7b3dc134-2b1b-0410-93df-9e9f96275f8d
Diffstat (limited to 'libc/sysdeps/ieee754')
-rw-r--r--libc/sysdeps/ieee754/flt-32/e_j0f.c2
-rw-r--r--libc/sysdeps/ieee754/flt-32/e_j1f.c2
-rw-r--r--libc/sysdeps/ieee754/ldbl-128/e_j0l.c3
-rw-r--r--libc/sysdeps/ieee754/ldbl-128/e_j1l.c2
-rw-r--r--libc/sysdeps/ieee754/ldbl-128/e_powl.c6
-rw-r--r--libc/sysdeps/ieee754/ldbl-128/s_atanl.c17
-rw-r--r--libc/sysdeps/ieee754/ldbl-128/s_nearbyintl.c2
-rw-r--r--libc/sysdeps/ieee754/ldbl-128/s_rintl.c2
-rw-r--r--libc/sysdeps/ieee754/ldbl-128ibm/e_hypotl.c4
-rw-r--r--libc/sysdeps/ieee754/ldbl-128ibm/e_powl.c6
-rw-r--r--libc/sysdeps/ieee754/ldbl-128ibm/s_atanl.c16
-rw-r--r--libc/sysdeps/ieee754/ldbl-128ibm/s_expm1l.c2
-rw-r--r--libc/sysdeps/ieee754/ldbl-128ibm/s_fmal.c8
-rw-r--r--libc/sysdeps/ieee754/ldbl-96/e_asinl.c9
14 files changed, 68 insertions, 13 deletions
diff --git a/libc/sysdeps/ieee754/flt-32/e_j0f.c b/libc/sysdeps/ieee754/flt-32/e_j0f.c
index 0729cd04e..c4cabd584 100644
--- a/libc/sysdeps/ieee754/flt-32/e_j0f.c
+++ b/libc/sysdeps/ieee754/flt-32/e_j0f.c
@@ -138,7 +138,7 @@ __ieee754_y0f(float x)
}
return z;
}
- if(ix<=0x32000000) { /* x < 2**-27 */
+ if(ix<=0x39800000) { /* x < 2**-13 */
return(u00 + tpi*__ieee754_logf(x));
}
z = x*x;
diff --git a/libc/sysdeps/ieee754/flt-32/e_j1f.c b/libc/sysdeps/ieee754/flt-32/e_j1f.c
index 30b7d8e25..cb9f97fa2 100644
--- a/libc/sysdeps/ieee754/flt-32/e_j1f.c
+++ b/libc/sysdeps/ieee754/flt-32/e_j1f.c
@@ -133,7 +133,7 @@ __ieee754_y1f(float x)
}
return z;
}
- if(__builtin_expect(ix<=0x24800000, 0)) { /* x < 2**-54 */
+ if(__builtin_expect(ix<=0x33000000, 0)) { /* x < 2**-25 */
return(-tpi/x);
}
z = x*x;
diff --git a/libc/sysdeps/ieee754/ldbl-128/e_j0l.c b/libc/sysdeps/ieee754/ldbl-128/e_j0l.c
index 112a8f3f9..1b1828958 100644
--- a/libc/sysdeps/ieee754/ldbl-128/e_j0l.c
+++ b/libc/sysdeps/ieee754/ldbl-128/e_j0l.c
@@ -809,6 +809,7 @@ static long double Y0_2D[NY0_2D + 1] = {
/* 1.000000000000000000000000000000000000000E0 */
};
+static const long double U0 = -7.3804295108687225274343927948483016310862e-02L;
/* Bessel function of the second kind, order zero. */
@@ -831,6 +832,8 @@ long double
return -HUGE_VALL + x;
}
xx = fabsl (x);
+ if (xx <= 0x1p-57)
+ return U0 + TWOOPI * __ieee754_logl (x);
if (xx <= 2.0L)
{
/* 0 <= x <= 2 */
diff --git a/libc/sysdeps/ieee754/ldbl-128/e_j1l.c b/libc/sysdeps/ieee754/ldbl-128/e_j1l.c
index 1f62bd092..f16343b26 100644
--- a/libc/sysdeps/ieee754/ldbl-128/e_j1l.c
+++ b/libc/sysdeps/ieee754/ldbl-128/e_j1l.c
@@ -838,6 +838,8 @@ __ieee754_y1l (long double x)
return -HUGE_VALL + x;
}
xx = fabsl (x);
+ if (xx <= 0x1p-114)
+ return -TWOOPI / x;
if (xx <= 2.0L)
{
/* 0 <= x <= 2 */
diff --git a/libc/sysdeps/ieee754/ldbl-128/e_powl.c b/libc/sysdeps/ieee754/ldbl-128/e_powl.c
index 40fc31473..d13175071 100644
--- a/libc/sysdeps/ieee754/ldbl-128/e_powl.c
+++ b/libc/sysdeps/ieee754/ldbl-128/e_powl.c
@@ -149,7 +149,7 @@ __ieee754_powl (long double x, long double y)
{
long double z, ax, z_h, z_l, p_h, p_l;
long double y1, t1, t2, r, s, t, u, v, w;
- long double s2, s_h, s_l, t_h, t_l;
+ long double s2, s_h, s_l, t_h, t_l, ay;
int32_t i, j, k, yisint, n;
u_int32_t ix, iy;
int32_t hx, hy;
@@ -282,6 +282,10 @@ __ieee754_powl (long double x, long double y)
return (hy > 0) ? huge * huge : tiny * tiny;
}
+ ay = y > 0 ? y : -y;
+ if (ay < 0x1p-128)
+ y = y < 0 ? -0x1p-128 : 0x1p-128;
+
n = 0;
/* take care subnormal number */
if (ix < 0x00010000)
diff --git a/libc/sysdeps/ieee754/ldbl-128/s_atanl.c b/libc/sysdeps/ieee754/ldbl-128/s_atanl.c
index 0138e792a..adac0a79e 100644
--- a/libc/sysdeps/ieee754/ldbl-128/s_atanl.c
+++ b/libc/sysdeps/ieee754/ldbl-128/s_atanl.c
@@ -167,6 +167,7 @@ static const long double
q4 = 2.173623741810414221251136181221172551416E1L;
/* q5 = 1.000000000000000000000000000000000000000E0 */
+static const long double huge = 1.0e4930L;
long double
__atanl (long double x)
@@ -197,6 +198,22 @@ __atanl (long double x)
return atantbl[83];
}
+ if (k <= 0x3fc50000) /* |x| < 2**-58 */
+ {
+ /* Raise inexact. */
+ if (huge + x > 0.0)
+ return x;
+ }
+
+ if (k >= 0x40720000) /* |x| > 2**115 */
+ {
+ /* Saturate result to {-,+}pi/2 */
+ if (sign)
+ return -atantbl[83];
+ else
+ return atantbl[83];
+ }
+
if (sign)
x = -x;
diff --git a/libc/sysdeps/ieee754/ldbl-128/s_nearbyintl.c b/libc/sysdeps/ieee754/ldbl-128/s_nearbyintl.c
index b335adcaa..d2afc10a5 100644
--- a/libc/sysdeps/ieee754/ldbl-128/s_nearbyintl.c
+++ b/libc/sysdeps/ieee754/ldbl-128/s_nearbyintl.c
@@ -37,7 +37,7 @@ long double __nearbyintl(long double x)
{
fenv_t env;
int64_t i0,j0,sx;
- u_int64_t i1;
+ u_int64_t i1 __attribute__ ((unused));
long double w,t;
GET_LDOUBLE_WORDS64(i0,i1,x);
sx = (((u_int64_t)i0)>>63);
diff --git a/libc/sysdeps/ieee754/ldbl-128/s_rintl.c b/libc/sysdeps/ieee754/ldbl-128/s_rintl.c
index 088d3c4d5..ae2142b2c 100644
--- a/libc/sysdeps/ieee754/ldbl-128/s_rintl.c
+++ b/libc/sysdeps/ieee754/ldbl-128/s_rintl.c
@@ -39,7 +39,7 @@ TWO112[2]={
long double __rintl(long double x)
{
int64_t i0,j0,sx;
- u_int64_t i1;
+ u_int64_t i1 __attribute__ ((unused));
long double w,t;
GET_LDOUBLE_WORDS64(i0,i1,x);
sx = (((u_int64_t)i0)>>63);
diff --git a/libc/sysdeps/ieee754/ldbl-128ibm/e_hypotl.c b/libc/sysdeps/ieee754/ldbl-128ibm/e_hypotl.c
index 00bfb1592..768bd3b06 100644
--- a/libc/sysdeps/ieee754/ldbl-128ibm/e_hypotl.c
+++ b/libc/sysdeps/ieee754/ldbl-128ibm/e_hypotl.c
@@ -61,7 +61,7 @@ __ieee754_hypotl(long double x, long double y)
if(hb > ha) {a=y;b=x;j=ha; ha=hb;hb=j;} else {a=x;b=y;}
a = fabsl(a); /* a <- |a| */
b = fabsl(b); /* b <- |b| */
- if((ha-hb)>0x3c0000000000000LL) {return a+b;} /* x/y > 2**60 */
+ if((ha-hb)>0x780000000000000LL) {return a+b;} /* x/y > 2**120 */
k=0;
kld = 1.0L;
if(ha > 0x5f30000000000000LL) { /* a>2**500 */
@@ -83,7 +83,7 @@ __ieee754_hypotl(long double x, long double y)
k += 600;
kld = two600;
}
- if(hb < 0x20b0000000000000LL) { /* b < 2**-500 */
+ if(hb < 0x23d0000000000000LL) { /* b < 2**-450 */
if(hb <= 0x000fffffffffffffLL) { /* subnormal b or 0 */
u_int64_t low;
GET_LDOUBLE_LSW64(low,b);
diff --git a/libc/sysdeps/ieee754/ldbl-128ibm/e_powl.c b/libc/sysdeps/ieee754/ldbl-128ibm/e_powl.c
index 0fd4820e4..8216c4906 100644
--- a/libc/sysdeps/ieee754/ldbl-128ibm/e_powl.c
+++ b/libc/sysdeps/ieee754/ldbl-128ibm/e_powl.c
@@ -149,7 +149,7 @@ __ieee754_powl (long double x, long double y)
{
long double z, ax, z_h, z_l, p_h, p_l;
long double y1, t1, t2, r, s, t, u, v, w;
- long double s2, s_h, s_l, t_h, t_l;
+ long double s2, s_h, s_l, t_h, t_l, ay;
int32_t i, j, k, yisint, n;
u_int32_t ix, iy;
int32_t hx, hy;
@@ -284,6 +284,10 @@ __ieee754_powl (long double x, long double y)
return (hy > 0) ? huge * huge : tiny * tiny;
}
+ ay = y > 0 ? y : -y;
+ if (ay < 0x1p-117)
+ y = y < 0 ? -0x1p-117 : 0x1p-117;
+
n = 0;
/* take care subnormal number */
if (ix < 0x00100000)
diff --git a/libc/sysdeps/ieee754/ldbl-128ibm/s_atanl.c b/libc/sysdeps/ieee754/ldbl-128ibm/s_atanl.c
index 779209d3d..2a36d16bb 100644
--- a/libc/sysdeps/ieee754/ldbl-128ibm/s_atanl.c
+++ b/libc/sysdeps/ieee754/ldbl-128ibm/s_atanl.c
@@ -199,6 +199,22 @@ __atanl (long double x)
return atantbl[83];
}
+ if (k <= 0x3c800000) /* |x| <= 2**-55. */
+ {
+ /* Raise inexact. */
+ if (1e300L + x > 0.0)
+ return x;
+ }
+
+ if (k >= 0x46c00000) /* |x| >= 2**109. */
+ {
+ /* Saturate result to {-,+}pi/2. */
+ if (sign)
+ return -atantbl[83];
+ else
+ return atantbl[83];
+ }
+
if (sign)
x = -x;
diff --git a/libc/sysdeps/ieee754/ldbl-128ibm/s_expm1l.c b/libc/sysdeps/ieee754/ldbl-128ibm/s_expm1l.c
index 98ae4e1ce..8808dcd89 100644
--- a/libc/sysdeps/ieee754/ldbl-128ibm/s_expm1l.c
+++ b/libc/sysdeps/ieee754/ldbl-128ibm/s_expm1l.c
@@ -85,7 +85,7 @@ static const long double
/* ln (2^16384 * (1 - 2^-113)) */
maxlog = 1.1356523406294143949491931077970764891253E4L,
/* ln 2^-114 */
- minarg = -7.9018778583833765273564461846232128760607E1L, big = 2e307L;
+ minarg = -7.9018778583833765273564461846232128760607E1L, big = 1e290L;
long double
diff --git a/libc/sysdeps/ieee754/ldbl-128ibm/s_fmal.c b/libc/sysdeps/ieee754/ldbl-128ibm/s_fmal.c
index a868b8d51..6706eb20e 100644
--- a/libc/sysdeps/ieee754/ldbl-128ibm/s_fmal.c
+++ b/libc/sysdeps/ieee754/ldbl-128ibm/s_fmal.c
@@ -1,5 +1,5 @@
/* Compute x * y + z as ternary operation.
- Copyright (C) 2011 Free Software Foundation, Inc.
+ Copyright (C) 2011-2012 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by David Flaherty <flaherty@linux.vnet.ibm.com>.
@@ -29,6 +29,12 @@ __fmal (long double x, long double y, long double z)
if ((finite ((double)x) && finite ((double)y)) && isinf ((double)z))
return (z);
+ /* If z is zero and x are y are nonzero, compute the result
+ as x * y to avoid the wrong sign of a zero result if x * y
+ underflows to 0. */
+ if (z == 0 && x != 0 && y != 0)
+ return x * y;
+
return (x * y) + z;
}
#ifdef IS_IN_libm
diff --git a/libc/sysdeps/ieee754/ldbl-96/e_asinl.c b/libc/sysdeps/ieee754/ldbl-96/e_asinl.c
index c33701f11..c1ffa3e0d 100644
--- a/libc/sysdeps/ieee754/ldbl-96/e_asinl.c
+++ b/libc/sysdeps/ieee754/ldbl-96/e_asinl.c
@@ -64,9 +64,12 @@
static const long double
one = 1.0L,
huge = 1.0e+4932L,
- pio2_hi = 1.5707963267948966192021943710788178805159986950457096099853515625L,
- pio2_lo = 2.9127320560933561582586004641843300502121E-20L,
- pio4_hi = 7.8539816339744830960109718553940894025800E-1L,
+ pio2_hi = 0x1.921fb54442d1846ap+0L, /* pi/2 rounded to nearest to 64
+ bits. */
+ pio2_lo = -0x7.6733ae8fe47c65d8p-68L, /* pi/2 - pio2_hi rounded to
+ nearest to 64 bits. */
+ pio4_hi = 0xc.90fdaa22168c235p-4L, /* pi/4 rounded to nearest to 64
+ bits. */
/* coefficient for R(x^2) */