This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
[PATCH 2/4] Check n instead of k1 to decide on sign of sin/cos result
- From: Siddhesh Poyarekar <siddhesh at sourceware dot org>
- To: libc-alpha at sourceware dot org
- Date: Tue, 27 Sep 2016 23:19:11 +0530
- Subject: [PATCH 2/4] Check n instead of k1 to decide on sign of sin/cos result
- Authentication-results: sourceware.org; auth=none
- References: <1474998553-2366-1-git-send-email-siddhesh@sourceware.org>
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.
* sysdeps/ieee754/dbl-64/s_sin.c (do_sincos_1): Check N
instead of K1.
---
sysdeps/ieee754/dbl-64/s_sin.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sysdeps/ieee754/dbl-64/s_sin.c b/sysdeps/ieee754/dbl-64/s_sin.c
index d60feb4..ea41a7c 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, int4 k)
case 3:
res = do_cos (a, da, &cor);
cor = (cor > 0) ? 1.025 * cor + eps : 1.025 * cor - eps;
- retval = ((res == res + cor) ? ((k1 & 2) ? -res : res)
+ retval = ((res == res + cor) ? ((n & 2) ? -res : res)
: sloww2 (a, da, x, n));
break;
}
--
2.7.4