aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSiddhesh Poyarekar <siddhesh@sourceware.org>2016-10-06 12:54:04 +0530
committerSiddhesh Poyarekar <siddhesh@sourceware.org>2016-10-06 12:54:04 +0530
commitead1ef37d2c3cd998dffb803c43a4fc2d08537ff (patch)
tree67f6cf0fe7edcc2757b22663fc780f32e5c35702
parent5455692aaf604e68d974524f18fc7bbcc97598f2 (diff)
downloadglibc-ead1ef37d2c3cd998dffb803c43a4fc2d08537ff.tar
glibc-ead1ef37d2c3cd998dffb803c43a4fc2d08537ff.tar.gz
glibc-ead1ef37d2c3cd998dffb803c43a4fc2d08537ff.tar.bz2
glibc-ead1ef37d2c3cd998dffb803c43a4fc2d08537ff.zip
Make quadrant shift a boolean in reduce_and_compute in s_sin.c
Like the previous change, make the quadrant shift a boolean to make it clearer that we will do at most a single rotation of the quadrants to compute the cosine from the sine function. This does not affect codegen.
-rw-r--r--ChangeLog7
-rw-r--r--sysdeps/ieee754/dbl-64/s_sin.c8
2 files changed, 11 insertions, 4 deletions
diff --git a/ChangeLog b/ChangeLog
index 34f3bf4274..d0cb39c0c3 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2016-10-06 Siddhesh Poyarekar <siddhesh@sourceware.org>
+
+ * sysdeps/ieee754/dbl-64/s_sin.c (reduce_and_compute): Make
+ K boolean and rename it.
+ (__sin): Adjust.
+ (__cos): Adjust.
+
2016-10-06 Rical Jasan <ricaljasan@pacific.net>
Siddhesh Poyarekar <siddhesh@sourceware.org>
diff --git a/sysdeps/ieee754/dbl-64/s_sin.c b/sysdeps/ieee754/dbl-64/s_sin.c
index 67bdebfd6c..26b984d207 100644
--- a/sysdeps/ieee754/dbl-64/s_sin.c
+++ b/sysdeps/ieee754/dbl-64/s_sin.c
@@ -268,11 +268,11 @@ do_sin_slow (double x, double dx, double eps, double *corp)
by simply rotating the quadrants by 1. */
static inline double
__always_inline
-reduce_and_compute (double x, unsigned int k)
+reduce_and_compute (double x, bool shift_quadrant)
{
double retval = 0, a, da;
unsigned int n = __branred (x, &a, &da);
- k = (n + k) % 4;
+ int4 k = (n + shift_quadrant) % 4;
switch (k)
{
case 2:
@@ -512,7 +512,7 @@ __sin (double x)
/* -----------------281474976710656 <|x| <2^1024----------------------------*/
else if (k < 0x7ff00000)
- retval = reduce_and_compute (x, 0);
+ retval = reduce_and_compute (x, false);
/*--------------------- |x| > 2^1024 ----------------------------------*/
else
@@ -605,7 +605,7 @@ __cos (double x)
/* 281474976710656 <|x| <2^1024 */
else if (k < 0x7ff00000)
- retval = reduce_and_compute (x, 1);
+ retval = reduce_and_compute (x, true);
else
{