[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: test failure for mappers.cc
From: |
Ben Abbott |
Subject: |
Re: test failure for mappers.cc |
Date: |
Wed, 10 Nov 2010 15:17:04 +0800 |
On Nov 10, 2010, at 2:23 PM, John W. Eaton wrote:
> On 10-Nov-2010, Ben Abbott wrote:
>
> | If you (anyone?) can tell me which library is responsible I'll take
> | a look at Apple's changes to the gcc sources. If I can find the
> | place to go, I'll file a bug report as well.
>
> The atan2f function should be in libm. What happens if you compile
> and run the following C program on your system? I see the following
> results on mine:
>
> M_PI = 3.141592741012573
> (float) M_PI = 3.1415927 (0x40490fdb)
> atan2f (0.0f, -1.0f) = 3.14159274 (0x40490fdb)
> atan2f (0.0f, -1.0f) - (float) M_PI = 0.00000000 (0x00000000)
>
> But it looks like there are special cases in the libc atan2 function
> (in the file sysdeps/ieee754/flt-32/e_atan2f.c):
>
> tiny = 1.0e-30,
> ...
> pi = 3.1415927410e+00, /* 0x40490fdb */
> ...
> /* when y = 0 */
> if(iy==0) {
> switch(m) {
> case 0:
> case 1: return y; /* atan(+-0,+anything)=+-0 */
> case 2: return pi+tiny;/* atan(+0,-anything) = pi */
> case 3: return -pi-tiny;/* atan(-0,-anything) =-pi */
> }
> }
>
> Both tiny and pi are declared as float in this function.
>
> jwe
I get the following
M_PI = 3.141592741012573
(float) M_PI = 3.1415927 (0x40490fdb)
atan2f (0.0f, -1.0f) = 3.14159250 (0x40490fda)
atan2f (0.0f, -1.0f) - (float) M_PI = -0.00000024 (0xb4800000)
Looking through Apple's sources, I don't see a atan2f.c. But I do see atan2f.s
...
http://www.opensource.apple.com/source/Libm/Libm-315/Source/Intel/atan2f.s
Ben