diff libquadmath/math/sincosq_kernel.c @ 111:04ced10e8804

gcc 7
author kono
date Fri, 27 Oct 2017 22:46:09 +0900
parents 561a7518be6b
children 1830386684a0
line wrap: on
line diff
--- a/libquadmath/math/sincosq_kernel.c	Sun Aug 21 07:07:55 2011 +0900
+++ b/libquadmath/math/sincosq_kernel.c	Fri Oct 27 22:46:09 2017 +0900
@@ -1,5 +1,5 @@
 /* Quad-precision floating point sine and cosine on <-pi/4,pi/4>.
-   Copyright (C) 1999 Free Software Foundation, Inc.
+   Copyright (C) 1999-2017 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Jakub Jelinek <jj@ultra.linux.cz>
 
@@ -110,12 +110,15 @@
       /* Argument is small enough to approximate it by a Chebyshev
 	 polynomial of degree 16(17).  */
       if (tix < 0x3fc60000)		/* |x| < 2^-57 */
-	if (!((int)x))			/* generate inexact */
-	  {
-	    *sinx = x;
-	    *cosx = ONE;
-	    return;
-	  }
+	{
+	  math_check_force_underflow (x);
+	  if (!((int)x))			/* generate inexact */
+	    {
+	      *sinx = x;
+	      *cosx = ONE;
+	      return;
+	    }
+	}
       z = x * x;
       *sinx = x + (x * (z*(SIN1+z*(SIN2+z*(SIN3+z*(SIN4+
 			z*(SIN5+z*(SIN6+z*(SIN7+z*SIN8)))))))));
@@ -126,14 +129,18 @@
     {
       /* So that we don't have to use too large polynomial,  we find
 	 l and h such that x = l + h,  where fabsl(l) <= 1.0/256 with 83
-	 possible values for h.  We look up cosl(h) and sinl(h) in
-	 pre-computed tables,  compute cosl(l) and sinl(l) using a
+	 possible values for h.  We look up cosq(h) and sinq(h) in
+	 pre-computed tables,  compute cosq(l) and sinq(l) using a
 	 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).  */
+	 sinq(h+l) = sinq(h)cosq(l) + cosq(h)sinq(l) and
+	 cosq(h+l) = cosq(h)cosq(l) - sinq(h)sinq(l).  */
       index = 0x3ffe - (tix >> 16);
       hix = (tix + (0x200 << index)) & (0xfffffc00 << index);
-      x = fabsq (x);
+      if (signbitq (x))
+       {
+         x = -x;
+         y = -y;
+       }
       switch (index)
 	{
 	case 0: index = ((45 << 10) + hix - 0x3ffe0000) >> 8; break;