about summary refs log tree commit diff
path: root/sysdeps/ieee754/ldbl-128ibm/k_sincosl.c
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps/ieee754/ldbl-128ibm/k_sincosl.c')
-rw-r--r--sysdeps/ieee754/ldbl-128ibm/k_sincosl.c21
1 files changed, 20 insertions, 1 deletions
diff --git a/sysdeps/ieee754/ldbl-128ibm/k_sincosl.c b/sysdeps/ieee754/ldbl-128ibm/k_sincosl.c
index 1cea6fef6e..cd2ce7ad1d 100644
--- a/sysdeps/ieee754/ldbl-128ibm/k_sincosl.c
+++ b/sysdeps/ieee754/ldbl-128ibm/k_sincosl.c
@@ -131,6 +131,25 @@ __kernel_sincosl(long double x, long double y, long double *sinx, long double *c
 	 Chebyshev polynomial of degree 10(11) and compute
 	 sinl(h+l) = sinl(h)cosl(l) + cosl(h)sinl(l) and
 	 cosl(h+l) = cosl(h)cosl(l) - sinl(h)sinl(l).  */
+      int six = tix;
+      tix = ((six - 0x3ff00000) >> 4) + 0x3fff0000;
+      index = 0x3ffe - (tix >> 16);
+      hix = (tix + (0x200 << index)) & (0xfffffc00 << index);
+      x = fabsl (x);
+      switch (index)
+	{
+	case 0: index = ((45 << 10) + hix - 0x3ffe0000) >> 8; break;
+	case 1: index = ((13 << 11) + hix - 0x3ffd0000) >> 9; break;
+	default:
+	case 2: index = (hix - 0x3ffc3000) >> 10; break;
+	}
+      hix = (hix << 4) & 0x3fffffff;
+/*
+    The following should work for double but generates the wrong index.
+    For now the code above converts double to ieee extended to compute
+    the index back to double for the h value. 
+    
+
       index = 0x3fe - (tix >> 20);
       hix = (tix + (0x2000 << index)) & (0xffffc000 << index);
       x = fabsl (x);
@@ -141,7 +160,7 @@ __kernel_sincosl(long double x, long double y, long double *sinx, long double *c
 	default:
 	case 2: index = (hix - 0x3fc30000) >> 14; break;
 	}
-
+*/
       SET_LDOUBLE_WORDS64(h, ((u_int64_t)hix) << 32, 0);
       if (iy)
 	l = y - (h - x);