M_PIl

Jelle Hermsen jelle at jellehermsen.nl
Mon Sep 3 02:15:02 PDT 2012


Using a bignum library like GMP ( http://gmplib.org/ ) might be a good 
idea when precision is that important.

Jelle

On 09/02/2012 02:35 AM, Pierre Abbat wrote:
> 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





More information about the Users mailing list