TECO macro which calculates Pi

Stanley Rabinowitz wrote a TECO macro for calculating pi in any number of decimals. The first time I heard about this, was through a messages posted to the comp.lang.c newsgroup by Martin Ambuhl, as a reply to a request for an algorithm computing Pi by Karl Poglitsch:

The above macro does work (according to Mark Henderson) with some current TECO implementations (Pete Siemsen's TECOC and Matt Fichtenbaum's UNIX TECO). E.g.
# TECOC-146
$ tecoc mung pi.tec,20
31415926535897932384
# Fichtenbaum TECO
$ te @pi.tec 20
31415926535897932384
Please note that two $$ are dollar signs, and must be replaced with two ESCs. Also, what you do is: teco @pi-macro nnn, where nnn is the numer of digits you wish to produce. It is 40 if nnn is not present.

here it is uuencoded:

begin 622 pi.tec
M1UHP2EQ53E%.(D4@-#!53B`G($)52"!"558@2$L*44X\($H@0E51(%%.*C$P
M+S-520I123P@7"LR*C$P*RA142I122E502!"($P@2R!122HR+3%52B!102]1
M2E51"E%!+2A142I12BDM,EP@,3!`22\O("TQ)4D@/@I142\Q,%54(%%(*U%4
M*S0X55<@45<M-3@B12`T.%57("56("<@458B3B!15EY4("<@45=55B!142TH
=450J,3`I54@@/@I15EY4($!>02\*+TA+15@;&PI1
`
end
And, by the way, Stanley Rabinowitz finally got an article published on the algorithm. If anyone is interested, you can find it at any university library: The alt.lang.teco newsgroup discusses TECO related problems. This newsgroup is also read by one of the original authors: Mark Bramhall.


My hacker page