about summary refs log tree commit diff
path: root/sysdeps/ieee754/dbl-64/sincos32.c
diff options
context:
space:
mode:
authorSiddhesh Poyarekar <siddhesh@redhat.com>2013-10-28 15:42:41 +0530
committerSiddhesh Poyarekar <siddhesh@redhat.com>2013-10-28 16:21:54 +0530
commitc79a12040c52623f23796966b806a2a6ce4e34d2 (patch)
tree1d011cc898d5410dde2313022754df09718f48ed /sysdeps/ieee754/dbl-64/sincos32.c
parent67beb54504ce1590b6868e3e1baab1db243110d1 (diff)
downloadglibc-c79a12040c52623f23796966b806a2a6ce4e34d2.tar.gz
glibc-c79a12040c52623f23796966b806a2a6ce4e34d2.tar.xz
glibc-c79a12040c52623f23796966b806a2a6ce4e34d2.zip
Consolidate conditionals in mp sin/cos functions
Consolidate conditionals in multiple precision sin and cos functions
to prepare the code for addition of probe points.
Diffstat (limited to 'sysdeps/ieee754/dbl-64/sincos32.c')
-rw-r--r--sysdeps/ieee754/dbl-64/sincos32.c14
1 files changed, 6 insertions, 8 deletions
diff --git a/sysdeps/ieee754/dbl-64/sincos32.c b/sysdeps/ieee754/dbl-64/sincos32.c
index f253b8ce8b..49aa148953 100644
--- a/sysdeps/ieee754/dbl-64/sincos32.c
+++ b/sysdeps/ieee754/dbl-64/sincos32.c
@@ -147,10 +147,9 @@ __sin32 (double x, double res, double res1)
   __dbl_mp (x, &c, p);		/* c = x  */
   __sub (&b, &c, &a, p);
   /* if a > 0 return min (res, res1), otherwise return max (res, res1).  */
-  if (a.d[0] > 0)
-    return (res < res1) ? res : res1;
-  else
-    return (res > res1) ? res : res1;
+  if ((a.d[0] > 0 && res >= res1) || (a.d[0] <= 0 && res <= res1))
+    res = res1;
+  return res;
 }
 
 /* Receive double x and two double results of cos(x) and return result which is
@@ -181,10 +180,9 @@ __cos32 (double x, double res, double res1)
   __dbl_mp (x, &c, p);		/* c = x                  */
   __sub (&b, &c, &a, p);
   /* if a > 0 return max (res, res1), otherwise return min (res, res1).  */
-  if (a.d[0] > 0)
-    return (res > res1) ? res : res1;
-  else
-    return (res < res1) ? res : res1;
+  if ((a.d[0] > 0 && res <= res1) || (a.d[0] <= 0 && res >= res1))
+    res = res1;
+  return res;
 }
 
 /* Compute sin() of double-length number (X + DX) as Multi Precision number and