]> git.ipfire.org Git - thirdparty/glibc.git/blobdiff - sysdeps/ieee754/ldbl-128ibm/k_sincosl.c
Update copyright dates with scripts/update-copyrights.
[thirdparty/glibc.git] / sysdeps / ieee754 / ldbl-128ibm / k_sincosl.c
index f3dd954887bcba6eac1624c8f47723c62f7702bf..f831e3f1f380abc21eb5b5f3284e549e4cf1d966 100644 (file)
@@ -1,5 +1,5 @@
 /* Quad-precision floating point sine and cosine on <-pi/4,pi/4>.
-   Copyright (C) 1999,2004,2006 Free Software Foundation, Inc.
+   Copyright (C) 1999-2015 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Jakub Jelinek <jj@ultra.linux.cz>
 
@@ -100,9 +100,12 @@ __kernel_sincosl(long double x, long double y, long double *sinx, long double *c
 {
   long double h, l, z, sin_l, cos_l_m1;
   int64_t ix;
-  u_int32_t tix, hix, index;
-  GET_LDOUBLE_MSW64 (ix, x);
-  tix = ((u_int64_t)ix) >> 32;
+  uint32_t tix, hix, index;
+  double xhi, hhi;
+
+  xhi = ldbl_high (x);
+  EXTRACT_WORDS64 (ix, xhi);
+  tix = ((uint64_t)ix) >> 32;
   tix &= ~0x80000000;                  /* tix = |x|'s high 32 bits */
   if (tix < 0x3fc30000)                        /* |x| < 0.1484375 */
     {
@@ -146,12 +149,16 @@ __kernel_sincosl(long double x, long double y, long double *sinx, long double *c
 /*
     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. 
-    
+    the index back to double for the h value.
+
 
       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;
@@ -160,7 +167,8 @@ __kernel_sincosl(long double x, long double y, long double *sinx, long double *c
        case 2: index = (hix - 0x3fc30000) >> 14; break;
        }
 */
-      SET_LDOUBLE_WORDS64(h, ((u_int64_t)hix) << 32, 0);
+      INSERT_WORDS64 (hhi, ((uint64_t)hix) << 32);
+      h = hhi;
       if (iy)
        l = y - (h - x);
       else