Posted on 03/19/2008 5:18:09 PM PDT by Paul Heinzman
My daughter, Anna, shared this with me this today. I thought I'd share it with my FRiends. Pi, Pi, Mathematical PI
This reminded me of Dr. Tom Lehrer’s “Periodic Table of the Elements” song. Thought you might enjoy it.
The primary purpose of the Data statement is to
give names to constants;
instead of referring to pi as 3.141592653589793
at every appearance, the variable Pi can be given
that value with a Data statement and used instead
of the longer form of the constant.
This also simplifies modifying the program, should
the value of pi change.
Fortran manual for Xerox Computers
Say what now?
Well, they didn’t word it well, but any digital rendering of PI will be off by a smidgen. In the FORTRAN manual, they were assuming a standard double precision decimal number. However, if a future version of FORTRAN (especially running under a 16 or 32 bit chip) might have more precision than what one could get on an old XEROX 820-II running FORTRAN. This way you get the benefit of the extra precision without having to rewrite that section of the program.
The value of Pi the number doesn’t change, but the value of Pi, the constant in FORTRAN might.
If pi is round than cornbread is squared.
Hmmm. Xerox doesn't make computers anymore - I wonder why?
Actually, if you're porting the program to a system that supports greater floating point precision (i.e. more digits to the right of the decimal), then the value of pi (as far as the computer hardware and program is concerned) WOULD change. So using the constant "pi" rather than the numeric value makes a lot of sense. Because the extra decimal places would be included in the libraries, and you wouldn't have to edit the source code, or patch the binaries.
Mark
Disclaimer: Opinions posted on Free Republic are those of the individual posters and do not necessarily represent the opinion of Free Republic or its management. All materials posted herein are protected by copyright law and the exemption for fair use of copyrighted works.