[clean-list] BigInt & GMP on Linux

Ronny Wichers Schreur ronny at cs.ru.nl
Tue Apr 4 10:11:00 MEST 2006


John van Groningen writes (to the Clean list):

> By the way, the example program that was included with ExtendedArith also
> computes pi, but in a different way using arctan and is more than 20 times
> faster for 2500 digits.

But it's not incremental.

> (the last digit is however computed incorrectly).


This is because of the accumulated rounding errors for the terms
in the Taylor series for arctan. There's a comment to that effect
in my version, but apparently it was removed in the ExtendedArith
distribution.

The number of terms that the algorithm computes to get to d digits
of pi is roughly

    0.5*(1/log10 18 + 1/log10 57 + 1/log10 239) * d = 0.89 * d.

The maximum rounding error for each term is one ULP (unit in the
last position). The terms for arctan alternate in sign, so the
total error is less than 0.89*d/2 ULPs. For d=2500 this is about
1117 ULPs. In practice it's much better, because many errors
from the negative and positive terms cancel out.


Cheers,

Ronny Wichers Schreur


More information about the clean-list mailing list