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: V01U2FsdGVkX180p/xF/hA0e7peHo7qTTNxGD/RSHQT9eE3ETXCL3 cmn3brVeEbjoyR From: Juan Manuel Guerrero To: djgpp-workers AT delorie DOT com Subject: Re: atan2 bug Date: Tue, 15 Sep 2009 00:42:54 +0200 User-Agent: KMail/1.9.10 References: <200909142122 DOT 34236 DOT juan DOT guerrero AT gmx DOT de> <83y6ohxos6 DOT fsf AT gnu DOT org> <200909150025 DOT 37854 DOT juan DOT guerrero AT gmx DOT de> In-Reply-To: <200909150025.37854.juan.guerrero@gmx.de> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200909150042.54219.juan.guerrero@gmx.de> X-Y-GMX-Trusted: 0 X-FuHaFi: 0.6 Reply-To: djgpp-workers AT delorie DOT com Sorry, I have submited a somewhat broken test program. diff -aprNU5 djgpp.orig/tests/libc/ansi/math/elefunt/atan2.c djgpp/tests/libc/ansi/math/elefunt/atan2.c --- djgpp.orig/tests/libc/ansi/math/elefunt/atan2.c 1970-01-01 00:00:00 +0000 +++ djgpp/tests/libc/ansi/math/elefunt/atan2.c 2009-09-15 00:35:38 +0000 @@ -0,0 +1,48 @@ +#include +#include +#include +#include + + +int main(void) +{ + _double_union_t x, y; + double result; + + y.d = M_PI; + x.dt.sign = 0; + x.dt.exponent = 0x07FF; + x.dt.mantissah = 0x000000000; + x.dt.mantissal = 0x000000000; /* +Infinity. */ + + /* + * Compute atan of the quotient of a positive finite number with pos. infinite. + * The result must be +0.0 + */ + errno = 0; + result = atan2(y.d, x.d); + if (errno) + printf("errno=%d\ny=%f x=%f: result=%f result must be +0.0\n", errno, y.d, x.d, result); + else if (result == +0.0) + printf("test passed.\n"); + else + printf("test failure not triggered by atan2 bug.\n"); + + + /* + * Compute atan of the quotient of a negative finite number with neg. infinite. + * The result must be -PI + */ + errno = 0; + y.dt.sign = 1; /* -Finite value. */ + x.dt.sign = 1; /* -Infinity. */ + result = atan2(y.d, x.d); + if (errno) + printf("errno=%d\ny=%f x=%f: result=%f result must be -PI\n", errno, y.d, x.d, result); + else if (result == -M_PI) + printf("test passed.\n"); + else + printf("test failure not triggered by atan2 bug.\n"); + + return 0; +}