X-Authentication-Warning: delorie.com: mail set sender to djgpp-workers-bounces using -f X-Recipient: djgpp-workers AT delorie DOT com X-Authenticated: #27081556 X-Provags-ID: V01U2FsdGVkX19MwLRxgwVMjKwSOT3BKtKeBcws4IqnEnXBKcVhD4 XeIzK1JucbVawB From: Juan Manuel Guerrero To: djgpp-workers AT delorie DOT com Subject: Re: atan2 bug Date: Wed, 7 Oct 2009 01:23:46 +0200 User-Agent: KMail/1.9.10 References: <200909142122 DOT 34236 DOT juan DOT guerrero AT gmx DOT de> <200909150025 DOT 37854 DOT juan DOT guerrero AT gmx DOT de> <4ACBA2AF DOT 8080104 AT cyberoptics DOT com> In-Reply-To: <4ACBA2AF.8080104@cyberoptics.com> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200910070123.47043.juan.guerrero@gmx.de> X-Y-GMX-Trusted: 0 X-FuHaFi: 0.6 Reply-To: djgpp-workers AT delorie DOT com Am Dienstag, 6. Oktober 2009 schrieb Eric Rudd: > Juan Manuel Guerrero wrote: > > - jnz badarg > > - movl 4(%esp), %eax > > + jne badarg /* x = NaN */ > > + movl 12(%esp), %eax > > I wrote this routine many years ago, so I thought I would be in a good > position to examine the proposed changes. When I ran the original code > for atan2(3, +inf), it actually produced the correct answer, but after > inspecting the code, I see that there actually *is* a bug, and that the > correct result I got was because the value at 4(%esp) just happened to > be zero on my platform. I agree with the changes proposed. I noticed the bug while I was writting long double versions of atan2l.S, atanl.S, tanl.S, sqrtl.S, sincosl.S, cosl.S, expl.S, sinl.S and may be some other but still not all of them. The double versions have been used as starting point. I needed them to port FFTW3 in the long double version. > Unfortunately, if we want the code to conform to C99, most of these > exception tests should be removed. Even if those versions do not fully satisfy the C99 standard, I think it is better than having no long double versions at all. Regards, Juan M. Guerrero