Fix low-part sign handling in sin/cos for ldbl-128 and ldbl-128ibm.

This commit is contained in:
Joseph Myers 2012-03-22 12:52:50 +00:00
parent e4d91429ae
commit c0df8e693f
7 changed files with 35 additions and 6 deletions

View File

@ -1,3 +1,16 @@
2012-03-22 Joseph Myers <joseph@codesourcery.com>
* sysdeps/ieee754/ldbl-128/k_cosl.c (__kernel_cosl): Negate y if
negating x to take absolute value.
* sysdeps/ieee754/ldbl-128/k_sincosl.c (__kernel_sincosl):
Likewise.
* sysdeps/ieee754/ldbl-128ibm/k_cosl.c (__kernel_cosl): Likewise.
* sysdeps/ieee754/ldbl-128ibm/k_sincosl.c (__kernel_sincosl):
Likewise.
* sysdeps/ieee754/ldbl-128/k_sinl.c (__kernel_sinl): Negate y when
computing low part if x was negated.
* sysdeps/ieee754/ldbl-128ibm/k_sinl.c (__kernel_sinl): Likewise.
2012-03-21 H.J. Lu <hongjiu.lu@intel.com>
* elf/tst-auditmod1.c: Support la_x32_gnu_pltenter and

View File

@ -105,7 +105,11 @@ __kernel_cosl(long double x, long double y)
cosl(h+l) = cosl(h)cosl(l) - sinl(h)sinl(l). */
index = 0x3ffe - (tix >> 16);
hix = (tix + (0x200 << index)) & (0xfffffc00 << index);
x = fabsl (x);
if (signbit (x))
{
x = -x;
y = -y;
}
switch (index)
{
case 0: index = ((45 << 10) + hix - 0x3ffe0000) >> 8; break;

View File

@ -132,7 +132,11 @@ __kernel_sincosl(long double x, long double y, long double *sinx, long double *c
cosl(h+l) = cosl(h)cosl(l) - sinl(h)sinl(l). */
index = 0x3ffe - (tix >> 16);
hix = (tix + (0x200 << index)) & (0xfffffc00 << index);
x = fabsl (x);
if (signbit (x))
{
x = -x;
y = -y;
}
switch (index)
{
case 0: index = ((45 << 10) + hix - 0x3ffe0000) >> 8; break;

View File

@ -116,7 +116,7 @@ __kernel_sinl(long double x, long double y, int iy)
SET_LDOUBLE_WORDS64(h, ((u_int64_t)hix) << 32, 0);
if (iy)
l = y - (h - x);
l = (ix < 0 ? -y : y) - (h - x);
else
l = x - h;
z = l * l;

View File

@ -123,7 +123,11 @@ __kernel_cosl(long double x, long double y)
index = 0x3fe - (tix >> 20);
hix = (tix + (0x200 << index)) & (0xfffffc00 << index);
x = fabsl (x);
if (signbit (x))
{
x = -x;
y = -y;
}
switch (index)
{
case 0: index = ((45 << 14) + hix - 0x3fe00000) >> 12; break;

View File

@ -151,7 +151,11 @@ __kernel_sincosl(long double x, long double y, long double *sinx, long double *c
index = 0x3fe - (tix >> 20);
hix = (tix + (0x2000 << index)) & (0xffffc000 << index);
x = fabsl (x);
if (signbit (x))
{
x = -x;
y = -y;
}
switch (index)
{
case 0: index = ((45 << 14) + hix - 0x3fe00000) >> 12; break;

View File

@ -134,7 +134,7 @@ __kernel_sinl(long double x, long double y, int iy)
*/
SET_LDOUBLE_WORDS64(h, ((u_int64_t)hix) << 32, 0);
if (iy)
l = y - (h - x);
l = (ix < 0 ? -y : y) - (h - x);
else
l = x - h;
z = l * l;