This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH] Fix cos computation for multiple precision fallback (bz #20357)
On Mon, Jul 18, 2016 at 09:47:43AM -0500, Paul E. Murphy wrote:
> > diff --git a/sysdeps/ieee754/dbl-64/s_sin.c b/sysdeps/ieee754/dbl-64/s_sin.c
> > index ca2532f..7c9a079 100644
> > --- a/sysdeps/ieee754/dbl-64/s_sin.c
> > +++ b/sysdeps/ieee754/dbl-64/s_sin.c
> > @@ -803,7 +803,7 @@ sloww (double x, double dx, double orig, int k)
> > a = t - y;
> > da = ((t - a) - y) + da;
> >
> > - if (n == 2 || n == 1)
> > + if (n & 2)
>
> That looks ok. I had to do double check the unification. It wasn't
> immediately obvious this was correct.
Yeah, the n == 1 check in csloww had thrown me off the last time - it
is because the input to csloww was always in quadrant 0 or 1 (0.855469
<|x| <2.426265) and hence the check for n == 2 is unnecessary in that
context. Rotating that by pi/2 for sin is consistent with the n & 2
check.
> > @@ -817,7 +817,7 @@ sloww (double x, double dx, double orig, int k)
> > if (w[0] == w[0] + cor)
> > return (a > 0) ? w[0] : -w[0];
> >
> > - return (n & 1) ? __mpcos (orig, 0, true) : __mpsin (orig, 0, true);
> > + return k ? __mpcos (orig, 0, true) : __mpsin (orig, 0, true);
>
> OK, that fix looks fairly obvious after reviewing commit
> b300455644e2945da05eb49d12d3a037f1408be1.
Thanks. Adhemerval, do you want to take another look at this or is it
OK if I commit it?
Siddhesh