about summary refs log tree commit diff
path: root/sysdeps/ieee754
diff options
context:
space:
mode:
authorSiddhesh Poyarekar <siddhesh@sourceware.org>2016-10-06 00:34:26 +0530
committerSiddhesh Poyarekar <siddhesh@sourceware.org>2016-10-06 00:34:26 +0530
commitba4e688461a0e3171a6c515040ec9200319070b6 (patch)
tree361d512b9b3abb301b3ffa313c73631bd6b69d2c /sysdeps/ieee754
parentb8b7e5e644363f9ab6ea6df5d4a44389d28e5450 (diff)
downloadglibc-ba4e688461a0e3171a6c515040ec9200319070b6.tar.gz
glibc-ba4e688461a0e3171a6c515040ec9200319070b6.tar.xz
glibc-ba4e688461a0e3171a6c515040ec9200319070b6.zip
Check n instead of k1 to decide on sign of sin/cos result
For k1 in 1 and 3, n can only have values of 0 and 2, so checking k1 &
2 is equivalent to checking n & 2.  We prefer the latter so that we
don't use k1 for anything other than selecting the quadrant in
do_sincos_1, thus dropping it completely.

The previous logic was:

    "Compute sine for the value and based on the new rotated quadrant
     (k1) negate the value if we're in the fourth quadrant."

With this change, the logic now is:

    "Compute sine for the value and negate it if we were either (1) in
     the fourth quadrant or (2) we actually wanted the cosine and were
     in the third quadrant."

	* sysdeps/ieee754/dbl-64/s_sin.c (do_sincos_1): Check N
	instead of K1.
Diffstat (limited to 'sysdeps/ieee754')
-rw-r--r--sysdeps/ieee754/dbl-64/s_sin.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/sysdeps/ieee754/dbl-64/s_sin.c b/sysdeps/ieee754/dbl-64/s_sin.c
index 76cf99619a..67bdebfd6c 100644
--- a/sysdeps/ieee754/dbl-64/s_sin.c
+++ b/sysdeps/ieee754/dbl-64/s_sin.c
@@ -353,7 +353,7 @@ do_sincos_1 (double a, double da, double x, int4 n, bool shift_quadrant)
     case 3:
       res = do_cos (a, da, &cor);
       cor = 1.025 * cor + __copysign (eps, cor);
-      retval = ((res == res + cor) ? ((k1 & 2) ? -res : res)
+      retval = ((res == res + cor) ? ((n & 2) ? -res : res)
 		: sloww2 (a, da, x, n));
       break;
     }