DragonFly BSD
DragonFly users List (threaded) for 2012-09
[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]

Re: M_PIl


From: Pierre Abbat <phma@xxxxxxxxxxxxx>
Date: Sat, 01 Sep 2012 20:35:33 -0400

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.



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