home *** CD-ROM | disk | FTP | other *** search
- *******************************************************
- piCalc - A program to find ¶ - pi - about 3.14159265...
- *******************************************************
-
- Requirements to using piCalc V2.5:
- - Amiga with 68020 or better CPU (a FPU is not needed and not used anyway)
- - Workbench/Kickstart 2.04 or better (I haven't tested it with less than 3.0)
- - About twice as much bytes memory as the accuracy you want pi
- - Time (and patience!)
-
- It uses no external libraries.
-
- This program is Freeware: It may be distributed freely for non-commercial
- purposes. It should be free and a copying fee must not exceed £2.
- This program may not be distributed with any magazine-coverdisk without
- written permission. It may be included in any PD-library or on CDs including
- PD software, such as the Fish, Aminet and other series including similar
- free software.
-
- The program and this docfile may not be changed or modified!
-
- YOU USE THIS PROGRAM ON YOUR OWN RISK. THE AUTHOR CAN NOT AND WILL NOT
- GUARANTEE ITS ACCURACY, NOR ANY OTHER DAMAGES ARISING FROM ANY USE OR
- MISUSE OF THIS PROGRAM AND DOCUMENTATION.
-
- If publishing a result produced by piCalc, please give credit to the author
- and state which version of the program you used (V2.5).
-
-
- History
- -------
-
- This program started as an AMOS program, which was able to calculate pi
- to 80 decimals, in JUST 35 MINUTES! (Amiga 1200) Because as we all know,
- AMOS is not particularly fast, so I ported the program to assembler, the
- first assembler version was able to calculate the first 1000 decimals
- in 5 minutes. But this wasn't good enough, so I optimised the
- assembler-program to be many times faster than the original assembler-program.
- That is the program "piCalc" and runs 50,000 times faster than the original
- (uncompiled) AMOS-program. (Who told you AMOS was fast?)
-
-
- How to use it
- -------------
-
- piCalc is Shell/CLI-only utility. To use it you have to open a shell-window.
- In its simplest form you write (from Shell)
-
- You can always stop the program with Ctrl-C.
-
- "piCalc XXXXX" where XXXXX is the number of decimals piCalc should calculate.
-
- The higher number of decimals the more time the calculation will take. If you
- think of calculating many decimals (more than 20000) you should run piCalc
- with the "ESTIMATE" option:
-
- "piCalc estimate 100000" will estimate how much time a calculation of 100000
- decimals will take, so that you won't be surprised by how slow things are
- going.
-
- If you want to save the result to a file, use "SAVEFILE=filename", the result
- will be written to this file when it has finished.
-
-
- Those options in full
- ---------------------
-
- Type "piCalc ?" for the piCalc Template:
-
- DECIMALS/N,EVERY/N,SAVEFILE,SAVEEVERY/N,NOTIFY/S,NOOUTPUT/S,ESTIMATE/S
-
-
- DECIMALS
- is the number of decimal places you want piCalc to calculate, this must be
- between 1 and 2,147,483,647. Except when "ESTIMATE" is selected, you will
- need just below twice as much memory free as the number of decimals you
- want to calculate pi to. (e.g. 1,000,000 decimals requires almost 2 MB
- memory.)
- (If not specified, the program uses 45 decimals)
-
- EVERY
- is how often you want piCalc to output its current calculation of pi. If you
- use "EVERY 10000" piCalc will output to screen (StdOut) when it has 10000,
- 20000, 30000 and so on of decimals. This option is probably most useful when
- used with the "NOTIFY" option.
-
- SAVEFILE
- when specified piCalc will save its calculation to the specified file, this
- it a much nicer method than running piCalc with a ">" redirection file.
- Beware: If piCalc can't create this file it would not give any error messages,
- just continue on!
-
- SAVEEVERY
- specifies how often piCalc should save its current calculation to SAVEFILE.
-
- NOTIFY
- is a very useful option in conjunction with the EVERY and SAVEFILE
- options. It notifies you how far it has come, writing "Dec: XXXX" to the
- Shell-window, where XXXX is how many decimals it has calculated so far, so
- you have some kind of control of the process. Write NOTIFY EVERY 1000 to
- have piCalc notify you every time it has calculated 1000 new decimals.
-
- NOOUTPUT
- is useful when you use the SAVEFILE option and don't want the pi to be
- echoed to screen as this can take quite a while with many decimals.
-
- ESTIMATE
- will estimate the TIME needed to calculate pi. The estimating may take
- a number of seconds (5-20) but will display a rough indication on how
- long the calculation will take: You should not touch the mouse or keyboard
- during this test, as this will cause piCalc to over-estimate the time needed.
-
-
- Is piCalc calculating the right value for pi?
- ---------------------------------------------
-
- I can not and will not guarantee the result produced by piCalc, it though
- seems to print the right values. Browsing through old editions of
- "The Guinness Book of Records" under "Most accurate version of 'pi'" I have
- been able to check some parts of the results.
- In the 1980 edition, I found this description of pi: 3.141592653589793 ...
- (omitting the next 999,975 places) ... 5779458151
- Those last 10 decimal places compared exactly to the result produced by
- piCalc 1000000, using the same method I have checked the decimal places
- before 100000 and 500000 to piCalc and found them to be the same, so piCalc
- seems to give correct values for pi.
-
- In the "E" Amiga programming environment there is a demo program, there is
- a demo program "pi.e" which besides that its much slower than piCalc
- produces the wrong number when you choose any high number, so better
- use piCalc!
-
-
- Please don't have a large number of other programs running when piCalc
- is busy calculating. A single bug in any of the programs running alongside
- piCalc could accidentally write to a memory location used by piCalc and
- giving a wrong result as piCalc does absolutely NONE checking on the
- result as this would decrease performance considerably.
-
-
- Program technicals (programmers)
- ---------------------------------
-
- This program uses 32/64 bit integer math, using the Mulu.L/Divu.L instructions
- heavily. The speed of this program therefore is largely dependent on the speed
- the CPU carries out such multiplications and dividitions. The program stores
- PI in longwords, each containing 9 digits. This limits the program to values
- multiple by 9. (9,18,27,36...)
-
- Why is 68020 required?
-
- Just because I was able to make the program 3 times faster when I could
- 68020 instructions instead of 68000 only.
-
-
- Program technicals (math)
- -------------------------
-
- Calculation method (very optimized in piCalc):
-
- 16/(1*5^1) - 16/(3*5^3) + 16/(5*5^5) - 16/(7*5^7) + 16/(9*5^9)...
- - 4/(1*239^1) + 16/(3*239^3) - 16/(5*239^5) + 16/(7*239^7) - 16/(9*239^9)...
-
- If you know a better formula/method or know another PI-calculation program
- (that is faster), please write to me!
-
-
- Author
- ------
-
- Write if you know of any SERIOUS bugs (pi is not accurate, fails on 68060,
- etc.) If you have calculated pi with more than 1,000,008 decimals using this
- program or know a more efficient formula or another Amiga program that is
- faster, please write!
-
- PS: Also try my program ECalc V2.5 that is identical to piCalc V2.5 except
- that it calculates e=2.718281828459045...
-
- My address:
- Steffen Thorsen
- Fjordgt. 8a
- N-4300 Sandnes
- Norway
-
- (No EMail yet, but I'll have Internet access from September 1995)
-