Openwall GNU/*/Linux - a small security-enhanced Linux distro for servers
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Tue, 10 Apr 2018 19:23:28 -0400
From: Rich Felker <dalias@...c.org>
To: musl@...ts.openwall.com
Subject: Re: catan errors

On Wed, Apr 11, 2018 at 01:08:50AM +0200, Szabolcs Nagy wrote:
> * Rich Felker <dalias@...c.org> [2018-04-10 15:50:07 -0400]:
> > 
> > 3. Is only possible if y==1.0 and x==0.0, which is the only real
> >    exceptional case for atan: z==I.
> > 
> > I opted to replace the non-obvious (3) with an explicit check for z==I
> > but this isn't necessary.
> > 
> ....
> >  	t = y - 1.0;
> >  	a = x2 + (t * t);
> > -	if (a == 0.0)
> > -		goto ovrf;
> 
> why does a==0 imply x==0?

OK, at least by my reasoning it's only algebraically true not
necessarily as doubles.

> if |x| < sqrt(2)*0x1p-538, x2 underflows to 0 in nearest rounding mode.
> 
> to handle this correctly extra work would need to be done, so i think
> either way is fine (leaving the goto there or not are both wrong, but
> we dont guarantee correct complex functions yet)

I'm fine with just moving the check back here. But the special case
(maybe not near-special cases with internal over/underflow though)
works fine just replacing the *I with CMPLX. See attached.

Rich

View attachment "catan2.diff" of type "text/plain" (637 bytes)

Powered by blists - more mailing lists

Your e-mail address:

Powered by Openwall GNU/*/Linux - Powered by OpenVZ