]> sourceware.org Git - glibc.git/commitdiff
consolidate sign checks for slow2
authorSiddhesh Poyarekar <siddhesh@sourceware.org>
Thu, 29 Sep 2016 23:45:55 +0000 (05:15 +0530)
committerSiddhesh Poyarekar <siddhesh@sourceware.org>
Thu, 29 Sep 2016 23:45:56 +0000 (05:15 +0530)
Simplify the code a bit by consolidating sign checks in slow1 and
slow2 into __sin at the higher level.

* sysdeps/ieee754/dbl-64/s_sin.c (slow1): Consolidate sign
check from here...
(slow2): ... and here...
(__sin): ... to here.

ChangeLog
sysdeps/ieee754/dbl-64/s_sin.c

index 1f9538c429319d58056b4764280ff6070ff199b6..6f5ac7257e1e523e61dd9db693e7ac8265df5e1a 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2016-09-29  Siddhesh Poyarekar  <siddhesh@sourceware.org>
+
+       * sysdeps/ieee754/dbl-64/s_sin.c (slow1): Consolidate sign
+       check from here...
+       (slow2): ... and here...
+       (__sin): ... to here.
+
 2016-09-28  Joseph Myers  <joseph@codesourcery.com>
 
        * math/math.h
index 18f1789bba3a313312bc9d1ebf08e6c61a147cbe..d60feb405fdf75c182284ece247359863800520f 100644 (file)
@@ -478,7 +478,8 @@ __sin (double x)
   else if (k < 0x3feb6000)
     {
       res = do_sin (x, 0, &cor);
-      retval = (res == res + 1.096 * cor) ? (m > 0 ? res : -res) : slow1 (x);
+      retval = (res == res + 1.096 * cor) ? res : slow1 (x);
+      retval = m > 0 ? retval : -retval;
     }                          /*   else  if (k < 0x3feb6000)    */
 
 /*----------------------- 0.855469  <|x|<2.426265  ----------------------*/
@@ -487,7 +488,8 @@ __sin (double x)
 
       t = hp0 - fabs (x);
       res = do_cos (t, hp1, &cor);
-      retval = (res == res + 1.020 * cor) ? ((m > 0) ? res : -res) : slow2 (x);
+      retval = (res == res + 1.020 * cor) ? res : slow2 (x);
+      retval = m > 0 ? retval : -retval;
     }                          /*   else  if (k < 0x400368fd)    */
 
 #ifndef IN_SINCOS
@@ -650,13 +652,13 @@ slow1 (double x)
 
   res = do_sin_slow (x, 0, 0, &cor);
   if (res == res + cor)
-    return (x > 0) ? res : -res;
+    return res;
 
   __dubsin (fabs (x), 0, w);
   if (w[0] == w[0] + 1.000000005 * w[1])
-    return (x > 0) ? w[0] : -w[0];
+    return w[0];
 
-  return (x > 0) ? __mpsin (x, 0, false) : -__mpsin (-x, 0, false);
+  return __mpsin (fabs (x), 0, false);
 }
 
 /**************************************************************************/
@@ -672,16 +674,16 @@ slow2 (double x)
   double t = hp0 - fabs (x);
   res = do_cos_slow (t, hp1, 0, &cor);
   if (res == res + cor)
-    return (x > 0) ? res : -res;
+    return res;
 
   y = fabs (x) - hp0;
   y1 = y - hp1;
   y2 = (y - y1) - hp1;
   __docos (y1, y2, w);
   if (w[0] == w[0] + 1.000000005 * w[1])
-    return (x > 0) ? w[0] : -w[0];
+    return w[0];
 
-  return (x > 0) ? __mpsin (x, 0, false) : -__mpsin (-x, 0, false);
+  return __mpsin (fabs (x), 0, false);
 }
 
 /***************************************************************************/
This page took 0.163552 seconds and 5 git commands to generate.