Computing zero to arbitrary precision

Computing mathematical constants to high precision is a favorite pastime for many characters in the history of computation and mathematics, reaching back thousands of years to Archimedes finding half a dozen digits of π by computing the area of regular 3 ⋅ 2n-gons. However, no constant is as interesting and useful as the additive identity, the non-negative non-positive nilpotent, the number that almost wasn’t, zero.

We present to the Academie a program which computes zero, which we will denote by z, to arbitrary precision. This is by using the well-known limit 1/2n → z as n → ∞. Solving for 2d error, where d is the required number of binary digits of precision, we see that n > d for the limit to converge within the specified tolerance.

The source code is available here. To compile, run

gcc --std=gnu99 -O2 -o zero zero.c
and to compute at least ten-million digits of zero, run
./zero -n 1100000
It is recommended that the output be redirected to a file since some digits may be lost in the scrollback buffer.

See also