]> git.ipfire.org Git - thirdparty/gcc.git/blobdiff - libquadmath/math/sincosq_kernel.c
Update most of libquadmath/math/ from glibc, automate update (PR libquadmath/68686).
[thirdparty/gcc.git] / libquadmath / math / sincosq_kernel.c
index 171ed6fc1178876f13cfd8bec4cec1267dc3ef76..9f0671bf1d0dc72fd93fc6a74745632114e44cce 100644 (file)
@@ -1,5 +1,5 @@
 /* Quad-precision floating point sine and cosine on <-pi/4,pi/4>.
-   Copyright (C) 1999-2017 Free Software Foundation, Inc.
+   Copyright (C) 1999-2018 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Jakub Jelinek <jj@ultra.linux.cz>
 
@@ -14,9 +14,8 @@
    Lesser General Public License for more details.
 
    You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
 
 #include "quadmath-imp.h"
 
@@ -89,15 +88,14 @@ static const __float128 c[] = {
  2.81068754939739570236322404393398135e-15Q, /* 3fce9510115aabf87aceb2022a9a9180 */
 };
 
-#define SINCOSQ_COS_HI 0
-#define SINCOSQ_COS_LO 1
-#define SINCOSQ_SIN_HI 2
-#define SINCOSQ_SIN_LO 3
+#define SINCOSL_COS_HI 0
+#define SINCOSL_COS_LO 1
+#define SINCOSL_SIN_HI 2
+#define SINCOSL_SIN_LO 3
 extern const __float128 __sincosq_table[];
 
 void
-__quadmath_kernel_sincosq(__float128 x, __float128 y, __float128 *sinx,
-                         __float128 *cosx, int iy)
+__quadmath_kernel_sincosq(__float128 x, __float128 y, __float128 *sinx, __float128 *cosx, int iy)
 {
   __float128 h, l, z, sin_l, cos_l_m1;
   int64_t ix;
@@ -128,7 +126,7 @@ __quadmath_kernel_sincosq(__float128 x, __float128 y, __float128 *sinx,
   else
     {
       /* 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
+        l and h such that x = l + h,  where fabsq(l) <= 1.0/256 with 83
         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
@@ -137,10 +135,10 @@ __quadmath_kernel_sincosq(__float128 x, __float128 y, __float128 *sinx,
       index = 0x3ffe - (tix >> 16);
       hix = (tix + (0x200 << index)) & (0xfffffc00 << index);
       if (signbitq (x))
-       {
-         x = -x;
-         y = -y;
-       }
+       {
+         x = -x;
+         y = -y;
+       }
       switch (index)
        {
        case 0: index = ((45 << 10) + hix - 0x3ffe0000) >> 8; break;
@@ -157,14 +155,14 @@ __quadmath_kernel_sincosq(__float128 x, __float128 y, __float128 *sinx,
       z = l * l;
       sin_l = l*(ONE+z*(SSIN1+z*(SSIN2+z*(SSIN3+z*(SSIN4+z*SSIN5)))));
       cos_l_m1 = z*(SCOS1+z*(SCOS2+z*(SCOS3+z*(SCOS4+z*SCOS5))));
-      z = __sincosq_table [index + SINCOSQ_SIN_HI]
-         + (__sincosq_table [index + SINCOSQ_SIN_LO]
-            + (__sincosq_table [index + SINCOSQ_SIN_HI] * cos_l_m1)
-            + (__sincosq_table [index + SINCOSQ_COS_HI] * sin_l));
+      z = __sincosq_table [index + SINCOSL_SIN_HI]
+         + (__sincosq_table [index + SINCOSL_SIN_LO]
+            + (__sincosq_table [index + SINCOSL_SIN_HI] * cos_l_m1)
+            + (__sincosq_table [index + SINCOSL_COS_HI] * sin_l));
       *sinx = (ix < 0) ? -z : z;
-      *cosx = __sincosq_table [index + SINCOSQ_COS_HI]
-             + (__sincosq_table [index + SINCOSQ_COS_LO]
-                - (__sincosq_table [index + SINCOSQ_SIN_HI] * sin_l
-                   - __sincosq_table [index + SINCOSQ_COS_HI] * cos_l_m1));
+      *cosx = __sincosq_table [index + SINCOSL_COS_HI]
+             + (__sincosq_table [index + SINCOSL_COS_LO]
+                - (__sincosq_table [index + SINCOSL_SIN_HI] * sin_l
+                   - __sincosq_table [index + SINCOSL_COS_HI] * cos_l_m1));
     }
 }