how to generate pi in c

Alex Stangl alex at
Fri Nov 5 19:25:21 UTC 2010

On Fri, Nov 05, 2010 at 05:40:39PM +0100, Arthur Bela wrote:
> Does anyone has a "generate-pi.c" source code?

Search for pi spigot algorithm.

Here is a tiny C program from Jeremy Gibbon's Unbounded Spigot paper
(due to Dik Winter and Achim Flammenkamp):


This produces the first 15,000 digits concisely, but is obfuscated.
If you need an unbounded number of digits, search out the spigot
algorithm papers.


More information about the freebsd-questions mailing list