This is from Christopher R Volpe <volpe@ash.crd.ge.com>.
This program computes
.
The big circle is not a trick and not a decoy. If you replace the circle with a larger circle (i.e. a better approximation of an ideal circle), it will compute a more precise value of pi.
The program relies on the preprocessor semantics of pre-ANSI C, so don't use newer ANSI-C compilers. The underscore is a macro which behaves differently depending on whether it is the first occurence on a line or not. If it's the first one on the line, it bumps two counters, one which counts the number of lines, and one which counts the number of underscores. If it's not the first one on the line, it bumps only the number of underscores. The result is a count of the total number of lines (proportional to the radius of the circle) and a count of the total number of underscores (proportional to the area of the circle). The program divides the area by the radius twice to obtain the value of pi.
Pretty neat, huh?
Wed Mar 20 18:12:34 EST 1996
, /dept/ecse/compeom/ho10
.tex