M_PIl

Pierre Abbat phma at phma.optus.nu
Sat Sep 1 17:35:33 PDT 2012


On Friday, August 31, 2012 18:33:36 Jelle Hermsen wrote:
> Personally I just define pi with 4*atan(1). Is there a good reason to use
> M_PI1 instead?

I defined M_PIl as (4*atan(1.)) and ran the program. It gave the same result as 
defining M_PIl as M_PI. The reason for using M_PIl is that it's a ten-byte 
float, so multiplying by it will result in better accuracy than multiplying by 
M_PI, which is an eight-byte float.

I once wrote a Mandelbrot/Julia program that gave wrong results; it was 
continuing the iteration instead of stopping when it saw a previously seen 
value. I submitted a bug to the GCC authors. It turned out to be not a bug in 
the compiler. The program was comparing a just-computed point, expressed as a 
ten-byte float in the processor, with a previously computed point, expressed as 
an eight-byte float in a double variable, and they were not equal.

Pierre
-- 
The Black Garden on the Mountain is not on the Black Mountain.





More information about the Users mailing list