octave-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: test failure for mappers.cc


From: Jarno Rajahalme
Subject: Re: test failure for mappers.cc
Date: Wed, 10 Nov 2010 13:48:04 +0200

On Nov 10, 2010, at 9:17 , ext Ben Abbott wrote:

> 
> 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

Looking at that code, it seems it is working as specified. Note:

"Return a value in [-pi, +pi] (C 7.12.4.4 3).  Note that this
prohibits returning correctly rounded values for -pi and +pi, since
pi rounded to a float lies outside that interval."

On octave, I get:

octave:5> pi - double(single(pi))
ans = -8.7423e-08

which shows that pi rounded to a single actually is larger than pi as a double, 
and therefore outside of the range [-pi, pi].

Regards,

  Jarno

                


reply via email to

[Prev in Thread] Current Thread [Next in Thread]