This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
[PATCH 4/5] Use DO_SIN for sin(x) where 0.25 < |x| < 0.855469
- From: Siddhesh Poyarekar <siddhesh at sourceware dot org>
- To: libc-alpha at sourceware dot org
- Date: Tue, 23 Aug 2016 23:52:44 +0530
- Subject: [PATCH 4/5] Use DO_SIN for sin(x) where 0.25 < |x| < 0.855469
- Authentication-results: sourceware.org; auth=none
- References: <1471976565-3576-1-git-send-email-siddhesh@sourceware.org>
The only code looks slightly different from DO_SIN but on closer
examination, should give exactly the same result. Drop it in favour
of the DO_SIN function call.
* sysdeps/ieee754/dbl-64/s_sin.c (__sin): Use DO_SIN.
---
sysdeps/ieee754/dbl-64/s_sin.c | 21 +++------------------
1 file changed, 3 insertions(+), 18 deletions(-)
diff --git a/sysdeps/ieee754/dbl-64/s_sin.c b/sysdeps/ieee754/dbl-64/s_sin.c
index e03c75a..82f9345 100644
--- a/sysdeps/ieee754/dbl-64/s_sin.c
+++ b/sysdeps/ieee754/dbl-64/s_sin.c
@@ -441,7 +441,7 @@ SECTION
#endif
__sin (double x)
{
- double xx, res, t, cor, y, s, c, sn, ssn, cs, ccs;
+ double xx, res, t, cor;
mynumber u;
int4 k, m;
double retval = 0;
@@ -471,23 +471,8 @@ __sin (double x)
/*---------------------------- 0.25<|x|< 0.855469---------------------- */
else if (k < 0x3feb6000)
{
- u.x = big + fabs (x);
- y = fabs (x) - (u.x - big);
- y = (x > 0 ? y : -y);
-
- xx = y * y;
- s = y + y * xx * (sn3 + xx * sn5);
- c = xx * (cs2 + xx * (cs4 + xx * cs6));
- SINCOS_TABLE_LOOKUP (u, sn, ssn, cs, ccs);
- if (m <= 0)
- {
- sn = -sn;
- ssn = -ssn;
- }
- cor = (ssn + s * ccs - sn * c) + cs * s;
- res = sn + cor;
- cor = (sn - res) + cor;
- retval = (res == res + 1.096 * cor) ? res : slow1 (x);
+ res = do_sin (x, 0, &cor);
+ retval = (res == res + 1.096 * cor) ? (m > 0 ? res : -res) : slow1 (x);
} /* else if (k < 0x3feb6000) */
/*----------------------- 0.855469 <|x|<2.426265 ----------------------*/
--
2.7.4