home *** CD-ROM | disk | FTP | other *** search
/ Gold Fish 3 / goldfish_volume_3.bin / files / fish / disks / d1110.lha / Programs / piCalc / PiCalc.Doc < prev    next >
Encoding:
Text File  |  1995-07-17  |  7.1 KB  |  186 lines

  1. *******************************************************
  2. piCalc - A program to find ¶ - pi - about 3.14159265...
  3. *******************************************************
  4.  
  5. Requirements to using piCalc V2.5:
  6. - Amiga with 68020 or better CPU  (a FPU is not needed and not used anyway)
  7. - Workbench/Kickstart 2.04 or better (I haven't tested it with less than 3.0)
  8. - About twice as much bytes memory as the accuracy you want pi
  9. - Time (and patience!)
  10.  
  11. It uses no external libraries.
  12.  
  13. This program is Freeware: It may be distributed freely for non-commercial
  14. purposes. It should be free and a copying fee must not exceed £2.
  15. This program may not be distributed with any magazine-coverdisk without
  16. written permission. It may be included in any PD-library or on CDs including
  17. PD software, such as the Fish, Aminet and other series including similar
  18. free software.
  19.  
  20. The program and this docfile may not be changed or modified!
  21.  
  22. YOU USE THIS PROGRAM ON YOUR OWN RISK. THE AUTHOR CAN NOT AND WILL NOT
  23. GUARANTEE ITS ACCURACY, NOR ANY OTHER DAMAGES ARISING FROM ANY USE OR
  24. MISUSE OF THIS PROGRAM AND DOCUMENTATION.
  25.  
  26. If publishing a result produced by piCalc, please give credit to the author
  27. and state which version of the program you used (V2.5).
  28.  
  29.  
  30. History
  31. -------
  32.  
  33. This program started as an AMOS program, which was able to calculate pi
  34. to 80 decimals, in JUST 35 MINUTES! (Amiga 1200) Because as we all know,
  35. AMOS is not particularly fast, so I ported the program to assembler, the
  36. first assembler version was able to calculate the first 1000 decimals
  37. in 5 minutes. But this wasn't good enough, so I optimised the
  38. assembler-program to be many times faster than the original assembler-program.
  39. That is the program "piCalc" and runs 50,000 times faster than the original
  40. (uncompiled) AMOS-program. (Who told you AMOS was fast?)
  41.  
  42.  
  43. How to use it
  44. -------------
  45.  
  46. piCalc is Shell/CLI-only utility. To use it you have to open a shell-window.
  47. In its simplest form you write (from Shell)
  48.  
  49. You can always stop the program with Ctrl-C.
  50.  
  51. "piCalc XXXXX" where XXXXX is the number of decimals piCalc should calculate.
  52.  
  53. The higher number of decimals the more time the calculation will take. If you
  54. think of calculating many decimals (more than 20000) you should run piCalc
  55. with the "ESTIMATE" option:
  56.  
  57. "piCalc estimate 100000" will estimate how much time a calculation of 100000
  58. decimals will take, so that you won't be surprised by how slow things are
  59. going.
  60.  
  61. If you want to save the result to a file, use "SAVEFILE=filename", the result
  62. will be written to this file when it has finished.
  63.  
  64.  
  65. Those options in full
  66. ---------------------
  67.  
  68. Type "piCalc ?" for the piCalc Template:
  69.  
  70. DECIMALS/N,EVERY/N,SAVEFILE,SAVEEVERY/N,NOTIFY/S,NOOUTPUT/S,ESTIMATE/S
  71.  
  72.  
  73. DECIMALS
  74. is the number of decimal places you want piCalc to calculate, this must be
  75. between 1 and 2,147,483,647. Except when "ESTIMATE" is selected, you will
  76. need just below twice as much memory free as the number of decimals you
  77. want to calculate pi to. (e.g. 1,000,000 decimals requires almost 2 MB
  78. memory.)
  79. (If not specified, the program uses 45 decimals)
  80.  
  81. EVERY
  82. is how often you want piCalc to output its current calculation of pi. If you
  83. use "EVERY 10000" piCalc will output to screen (StdOut) when it has 10000, 
  84. 20000, 30000 and so on of decimals. This option is probably most useful when
  85. used with the "NOTIFY" option.
  86.  
  87. SAVEFILE
  88. when specified piCalc will save its calculation to the specified file, this
  89. it a much nicer method than running piCalc with a ">" redirection file.
  90. Beware: If piCalc can't create this file it would not give any error messages,
  91. just continue on!
  92.  
  93. SAVEEVERY
  94. specifies how often piCalc should save its current calculation to SAVEFILE.
  95.  
  96. NOTIFY
  97. is a very useful option in conjunction with the EVERY and SAVEFILE
  98. options. It notifies you how far it has come, writing "Dec: XXXX"  to the
  99. Shell-window, where XXXX is how many decimals it has calculated so far, so
  100. you have some kind of control of the process. Write NOTIFY EVERY 1000 to
  101. have piCalc notify you every time it has calculated 1000 new decimals.
  102.  
  103. NOOUTPUT
  104. is useful when you use the SAVEFILE option and don't want the pi to be
  105. echoed to screen as this can take quite a while with many decimals.
  106.  
  107. ESTIMATE
  108. will estimate the TIME needed to calculate pi. The estimating may take
  109. a number of seconds (5-20) but will display a rough indication on how
  110. long the calculation will take: You should not touch the mouse or keyboard
  111. during this test, as this will cause piCalc to over-estimate the time needed.
  112.  
  113.  
  114. Is piCalc calculating the right value for pi?
  115. ---------------------------------------------
  116.  
  117. I can not and will not guarantee the result produced by piCalc, it though
  118. seems to print the right values. Browsing through old editions of
  119. "The Guinness Book of Records" under "Most accurate version of 'pi'" I have
  120. been able to check some parts of the results.
  121. In the 1980 edition, I found this description of pi: 3.141592653589793 ...
  122. (omitting the next 999,975 places) ... 5779458151
  123. Those last 10 decimal places compared exactly to the result produced by
  124. piCalc 1000000, using the same method I have checked the decimal places
  125. before 100000 and 500000 to piCalc and found them to be the same, so piCalc
  126. seems to give correct values for pi.
  127.  
  128. In the "E" Amiga programming environment there is a demo program, there is
  129. a demo program "pi.e" which besides that its much slower than piCalc
  130. produces the wrong number when you choose any high number, so better
  131. use piCalc!
  132.  
  133.  
  134. Please don't have a large number of other programs running when piCalc
  135. is busy calculating. A single bug in any of the programs running alongside
  136. piCalc could accidentally write to a memory location used by piCalc and
  137. giving a wrong result as piCalc does absolutely NONE checking on the
  138. result as this would decrease performance considerably.
  139.  
  140.  
  141. Program technicals (programmers)
  142. ---------------------------------
  143.  
  144. This program uses 32/64 bit integer math, using the Mulu.L/Divu.L instructions
  145. heavily. The speed of this program therefore is largely dependent on the speed
  146. the CPU carries out such multiplications and dividitions. The program stores
  147. PI in longwords, each containing 9 digits. This limits the program to values
  148. multiple by 9. (9,18,27,36...)
  149.  
  150. Why is 68020 required?
  151.  
  152. Just because I was able to make the program 3 times faster when I could
  153. 68020 instructions instead of 68000 only.
  154.  
  155.  
  156. Program technicals (math)
  157. -------------------------
  158.  
  159. Calculation method (very optimized in piCalc):
  160.  
  161.   16/(1*5^1)  - 16/(3*5^3)   + 16/(5*5^5)   - 16/(7*5^7)   + 16/(9*5^9)...
  162. - 4/(1*239^1) + 16/(3*239^3) - 16/(5*239^5) + 16/(7*239^7) - 16/(9*239^9)...
  163.  
  164. If you know a better formula/method or know another PI-calculation program
  165. (that is faster), please write to me!
  166.  
  167.  
  168. Author
  169. ------
  170.  
  171. Write if you know of any SERIOUS bugs (pi is not accurate, fails on 68060,
  172. etc.) If you have calculated pi with more than 1,000,008 decimals using this
  173. program or know a more efficient formula or another Amiga program that is
  174. faster, please write! 
  175.  
  176. PS: Also try my program ECalc V2.5 that is identical to piCalc V2.5 except
  177. that it calculates e=2.718281828459045...
  178.  
  179. My address:
  180. Steffen Thorsen
  181. Fjordgt. 8a
  182. N-4300 Sandnes
  183. Norway
  184.  
  185. (No EMail yet, but I'll have Internet access from September 1995)
  186.