Tafelmusik

An Illusory Intertwingling of Reason and Response

Tafelmusik is a look askance at life. It is a chronicle of the Dance of the Good Thing, a part in which I strive always to take. Here lie my musings, my thoughts, my beliefs, and my desires. Join me. Dance.

Tafel :: notes

Monday, September 11, 2006

Algorithms for Pi

Just a note to self, so I don't lose some of these sites I've found.

I've been looking at algorithms to calculate π (pi) recently. I've not actually installed and learned anything like GMP, MAPM, MPFR, or other so-called "bignum" libraries, so I'm pretty much limited to the digits that can be stored in a double. *sniff* Well, I'll get around to it eventually, eh?

So, the major algorithms I've found are as follows:

I've implemented Aristotle's algorithm and Gregory's series, and filled a double with accurate values for π (pi) fairly quickly. Actually, the expansion of Gregory's series rand several orders of magnitude faster. I suppose now I should install GMP and play with actual numbers instead of these piddly little doubles.

See also: History of numerical approximations of pi on Wikipedia

Technorati