Message ID | 1471976565-3576-5-git-send-email-siddhesh@sourceware.org |
---|---|
State | New |
Headers | show |
Ping! On Tuesday 23 August 2016 11:52 PM, Siddhesh Poyarekar wrote: > 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 ----------------------*/ >
On Tue, 23 Aug 2016, Siddhesh Poyarekar wrote: > 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. OK, but it's do_sin not DO_SIN; uppercasing only applies when referring to the value of a variable.
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 ----------------------*/