Easy as Pi
How Far We've Come, Part 2
by Blake Linton Wilfong -- The Wondersmith!

While cleaning a closet a few days ago, I came across an old magazine article that included a listing of a program to calculate the first 1000 digits of pi. It was "Apple Pi" by Robert J. Bishop, written in 1978 in Integer BASIC for Apple II computers with just 16 kilobytes of memory. (Yes, that's just 16,384 bytes of RAM!) Included was a vital bit of benchmark information: the program took almost 40 hours to produce a 1000-digit result.

For those who don't remember their grade-school math, pi is defined as the ratio between a circle's diameter and its circumference--approximately 3.14. To express pi exactly would require an infinite number of digits, and those digits never start repeating the way ordinary fractions like 1/3 do. The fact that such a simple concept leads to infinite complexity hints at something almost mystical about the underlying nature of the universe. Archeologists have found evidence that mathematicians fascinated with pi have spent millennia computing its value more and more precisely--though of course the greatest progress has been made since the advent of computers.

Back to Apple Pi. It was a pretty simple task for me to convert this program to Microsoft QuickBASIC 4.5, for which I happen to have a compiler. I checked the output against a listing of the first 1,000 digits of pi from another source and confirmed that it was working correctly. Now I could run Apple Pi on a modern-day computer, my friend's HP Pavilion 6735 with a 633MHz Intel Celeron.

The first calculation of pi by an electronic computer was made in 1949 on the ENIAC, a huge monstrosity of 17,468 vacuum tubes. It produced 2,037 digits in 70 hours. The compiled version of Apple Pi duplicates this result in about one second on a modern midrange PC--or 250,000 times as fast! This is a particularly interesting comparison because ENIAC's program was hard-wired--which makes it comparable to a compiled program--and the algorithm Apple Pi uses is Machin's formula, the very same formula used on the ENIAC! Thus we can see exactly how far hardware has advanced since the earliest days of computing.

So how fast is it? We first ran the program in interpeted mode, similar to the way it would have operated on the old Apple II. The result was astounding: 1,000 digits of pi in 2.86 seconds, or 50,000 times as fast as the Apple II! When compiled, the program ran in 0.27 seconds, or some 500,000 times as fast as the Apple II, but it's unfair to compare an interpreter to a compiler. (In case you're wondering, the Celeron's speedy Floating Point Unit cannot account for this tremendous difference. Apple Pi uses long chains of integer calculations--not floating point--to attain its 1,000-digit precision. The speed difference is genuine.)

These results support my recent claims that computer performance has advanced by a factor of more than 10,000 in the last 20 years. In fact, I may have been too conservative! Much too conservative, because little Apple Pi doesn't utilize the full capabilities of modern hardware, like extra memory and expanded instruction sets, or improvements in software, like more efficient pi formulas and computational algorithms.

Want a state-of-the-art pi-calculating program for your PC? Try Xavier Gourdon's freeware PiFast, along with its documentation and usage text files. This program utilizes the same pi-finding formula that the Chudnovsky brothers have used on mainframe computers in their record-breaking multibillion-digit pi calculations in the last decade or so.

I've already demonstrated that modern-day chess programs running on modern-day PCs are many times faster and stronger than the best chess programs running on the best supercomputers back in 1980. (See my rant "How Far We've Come" for details.) The same result holds true for pi-finding software.

Back in 1973, Jean Guilloud and M. Bouyer used a CDC 7600 mainframe to compute 1 million digits of pi in 23.3 hours. My friend's new HP Pavilion 6735 computer with its 64MB RAM and 633MHz Intel Celeron accomplished the same feat with PiFast in a mere 26 seconds! In 1983, Y. Tamura and Y. Kanada reported using a Hitachi M-280H supercomputer to calculate pi to 16,777,206 digits in under 30 hours. My friend's computer duplicated this result in just 22 minutes! Yup, we've come a long way.

Summing up, it's again clear that computer hardware and software are advancing at a staggering rate, and that we can expect to see marvels beyond our wildest imagination in the next decades. Breakthroughs in artificial intelligence, robotics, and virtual reality are just around the corner. You don't need a time machine to reach the future; all you have to do is wait a few years, and you will witness veritable miracles of technology. Enjoy!

to the Rants, Raves, and Reviews main page
to The World of the Wondersmith

Rants, Raves, and Reviews
Copyright © 1999-2011 Blake Linton Wilfong
All rights reserved.

Apple Pie image from Hemera Photo Objects Premium Image Collection
by Hemera Technologies Inc. Used under license.