Extended Precision pi II

About the program

This program can calculate &PI up to 1287 digits, but unlike EPP1 it does not print the result directly. The program was originally written by M.\Colmont and his version appeared in the French scientific journal "Science et Vie" in 1980. [Science et Vie 12/80, pages\54-57]

A first revision of the program was made by Palmer O. Hanson, editor of TI\PPC Notes. His version used Fast Mode to speed up the program, as the original version was very S-L-O-W. Palmer's revision, which was still slow -\the version included is just a tiny bit faster\- appeared in TI\PPC Notes V8N4P21-26, together with a translation of the original article.

The version presented here is a minor revision of Palmer's program. Modifications include:

Method Used

To obtain the high precision this program delivers, the following method is used: :fn id=pi2.The program uses k=0 to k=INT(# of digits / Log(2) + 1).:efn :lq.

The program starts with this, not very well known, equation: .sk .ce &PI./2 = 1 + 1/3 + (1&ML.2)/(3&ML.5) + (1&ML.2&ML.3)/(3&ML.5&ML.7) + .....

Thus &PI./2 is equal to the sum of the series k!/1&ML.3&ML ... &ML.(2k\+\1) from k\=\0 to k\=\&INF..:fnref refid=pi2

The series is first reversed and then factored: .sk .ce &PI = ((...(2n/(2n+1) + 2) &ML (n-1)/(2n-1) + 2) &ML ... ) &ML 1/3 + 2

This method avoids addition of terms of the series to the preceding sums. The resulting program contains only a multiplication and a division. :elq

The multiplication and division loops can be found in the program on steps 018-065 and 073-143 respectively. To avoid problems in both loops, each register is divided into two pseudo-registers, using the same format as in EPF2, that is AAAAAA.ZZZZZZZ.

The TI-59 Version

User Instructions

The instructions for this version of the program are:

  1. Enter the program.
  2. Enter the number of digits you want and press A. After a short time the calculator will stop with a flashing\1 in the display. [The number you enter will be rounded up to the next multiple of 13, and if you enter a number greater than 1287, it will return to the display flashing, to indicate an error].
  3. Now press 7 EE to start the program in Fast Mode.
    When the program has ended, after you return from your holidays, the display will show a zero.
  4. The result can now be found by recalling the registers, starting at R01, up to the first register that contains a zero, each time writing down the 6 digits to the left of the decimal point -\think about leading zeroes\-, pressing INV INT and writing down the 7 digits to the right of the decimal point -\think about trailing zeroes this time (Use FIX\7 to make them visible)

The above method of displaying the result is not very "Anwenderfreundlich". To relieve the pain you can enter this short program from the keyboard when the program has finished. After having entered it you can press E, repeatedly followed by R/S to display the result. (If you have a PC-100, you can of course change steps 013 and 017 into PRT)

Listing of the read-out program .sk

000  76 LBL         008  53  (          016  07  07         024  22 INV
001  15  E          009  73 RC*         017  91 R/S         025  77 XòT
002  82 HIR         010  00  00         018  22 INV         026  00  00
003  18  18         011  75  -          019  58 FIX         027  08  08
004  32 X:T         012  59 INT         020  43 RCL         028  00  0
005  01  1          013  91 R/S         021  00  00         029  69 OP
006  42 STO         014  54  )          022  69 OP          030  68  68
007  00  00         015  58 FIX         023  20  20         031  92 RTN
<\pre>

Listing of the TI-59 Version

000  92 RTN         060  74 SM*         120  54  )          180  00  0
001  01  1          061  00  00         121  32 X:T         181  00  0
002  00  0          062  97 DSZ         122  22 INV         182  00  0
003  69 OP          063  00  00         123  52 EE          183  00  0
004  17  17         064  00  00         124  52 EE          184  00  0
005  47 CMS         065  16  16         125  07  7          185  00  0
006  69 OP          066  02  2          126  94 +/-         186  76 LBL
007  20  20         067  82 HIR         127  74 SM*         187  11  A
008  25 CLR         068  47  47         128  00  00         188  50 IxI
009  29 CP          069  01  1          129  43 RCL         189  59 INT
010  82 HIR         070  82 HIR         130  00  00         190  32 X:T
011  17  17         071  37  37         131  53  (          191  01  1
012  66 PAU         072  32 X:T         132  32 X:T         192  02  2
013  67 X=T         073  69 OP          133  85  +          193  08  8
014  01  01         074  20  20         134  82 HIR         194  07  7
015  58  58         075  53  (          135  18  18         195  77 XòT
016  73 RC*         076  53  (          136  67 X=T         196  02  02
017  00  00         077  22 INV         137  01  01         197  03  03
018  53  (          078  52 EE          138  44  44         198  00  0
019  53  (          079  52 EE          139  00  0          199  32 X:T
020  32 X:T         080  06  6          140  54  )          200  69 OP
021  22 INV         081  85  +          141  61 GTO         201  68  68
022  52 EE          082  73 RC*         142  00  00         202  92 RTN
023  52 EE          083  00  00         143  73  73         203  32 X:T
024  07  7          084  59 INT         144  54  )          204  53  (
025  94 +/-         085  75  -          145  03  3          205  60 DEG
026  85  +          086  53  (          146  82 HIR         206  55  ö
027  73 RC*         087  46 INS         147  57  57         207  01  1
028  00  00         088  55  ö          148  02  2          208  03  3
029  22 INV         089  82 HIR         149  82 HIR         209  85  +
030  59 INT         090  17  17         150  67  67         210  93  .
031  65  x          091  54  )          151  52 EE          211  09  9
032  82 HIR         092  59 INT         152  05  5          212  03  3
033  17  17         093  65  x          153  44 SUM         213  54  )
034  75  -          094  32 X:T         154  01  01         214  59 INT
035  22 INV         095  82 HIR         155  61 GTO         215  53  (
036  59 INT         096  17  17         156  00  00         216  82 HIR
037  72 ST*         097  85  +          157  08  08         217  08  08
038  00  00         098  32 X:T         158  81 RST         218  65  x
039  85  +          099  63 EX*         159  00  0          219  01  1
040  32 X:T         100  00  00         160  00  0          220  03  3
041  59 INT         101  22 INV         161  00  0          221  55  ö
042  65  x          102  59 INT         162  00  0          222  02  2
043  82 HIR         103  54  )          163  00  0          223  28 LOG
044  17  17         104  65  x          164  00  0          224  85  +
045  54  )          105  01  1          165  00  0          225  01  1
046  55  ö          106  52 EE          166  00  0          226  54  )
047  01  1          107  07  7          167  00  0          227  59 INT
048  52 EE          108  75  -          168  00  0          228  82 HIR
049  06  6          109  53  (          169  00  0          229  07  07
050  75  -          110  46 INS         170  00  0          230  22 INV
051  59 INT         111  55  ö          171  00  0          231  58 FIX
052  65  x          112  82 HIR         172  00  0          232  09  9
053  32 X:T         113  17  17         173  00  0          233  69 OP
054  01  1          114  54  )          174  00  0          234  17  17
055  54  )          115  59 INT         175  00  0          235  04  4
056  22 INV         116  65  x          176  00  0          236  05  5
057  52 EE          117  32 X:T         177  00  0          237  30 TAN
058  52 EE          118  82 HIR         178  00  0          238  33 Xý
059  06  6          119  17  17         179  00  0          239  86 STF
<\pre>

The TI-58 Version

User Instructions

The user instructions for this version of the program are exactly the same, except for the fact that the calculator will return the number you entered flashing to the display when it is greater than 507.

Listing of the TI-58 Version

To obtain the TI-58 version of the program, you first key in the TI-59 version. Next you make the following modifications in the indicated order:

  1. Change step 001 into "4".
  2. Change step 015 into "57".
  3. Change step 065 into "15".
  4. Change step 138 into "43".
  5. Change step 143 into "72".
  6. Change step 157 into "07".
  7. Change step 191-193 into "5" "0" "7".
  8. Change step 197 into "06".
  9. Delete steps 232-234.
  10. Delete step 194.
  11. Delete step 002.
  12. Insert five zeroes after step 157.

Instead of first entering the TI-59 version, it is of course also possible to make the above changes directly while keying in the program.

The TI-66 Version

User Instructions

The user instructions for this version of the program are:

  1. Put fresh batteries in the calculator.
  2. Set the partitioning to 183.40. [Part 41]
  3. Enter the number of digits you want and press A. [The number you enter will be rounded up to the next multiple of 13. If you enter a number greater than 494 the calculator will assume you entered\494]
  4. When the program has finished you can display the results using the same method as described in the TI-59 section, but you can also enter the following short program and press E, repeatedly followed by R/S. The read-out is complete when a zero with nine decimal points appears.

Listing of the read-out program .sk

000  29 LBL         008  2A  (          016  FC  07         024  31 INV
001  18  E          009  B3 RC*         017  25 R/S         025  69 XòT
002  33 RCL         010  F5  00         018  31 INV         026  F5  00
003  9E  40         011  3B  -          019  42 FIX         027  FD  08
004  24 X:T         012  76 INT         020  33 RCL         028  00  0
005  01  1          013  25 R/S         021  F5  00         029  36 1/X
006  32 STO         014  2B  )          022  23 OP          030  A9 RTN
007  F5  00         015  42 FIX         023  8A  20
<\pre>

Listing of the TI-66 Version

000  34 SUM         050  1B EE          100  3B  -          150  2A  (
001  F6  01         051  06  6          101  2A  (          151  04  4
002  2D CLR         052  31 INV         102  3D  /          152  09  9
003  41 CP          053  1B EE          103  33 RCL         153  04  4
004  33 RCL         054  B4 SM*         104  9D  39         154  69 XòT
005  9D  39         055  F5  00         105  2B  )          155  F6  01
006  66 PAU         056  65 DSZ         106  76 INT         156  D0  58
007  31 INV         057  F5  00         107  3C  x          157  29 LBL
008  64 X=T         058  81  11         108  1B EE          158  24 X:T
009  81  11         059  02  2          109  07  7          159  3D  /
010  A9 RTN         060  74 PRD         110  1A +/-         160  01  1
011  B3 RC*         061  9D  39         111  31 INV         161  03  3
012  F5  00         062  01  1          112  1B EE          162  3A  +
013  2A  (          063  34 SUM         113  B4 SM*         163  19  .
014  2A  (          064  9D  39         114  F5  00         164  09  9
015  24 X:T         065  24 X:T         115  33 RCL         165  03  3
016  3D  /          066  23 OP          116  F5  00         166  2B  )
017  07  7          067  8A  20         117  24 X:T         167  76 INT
018  31 INV         068  2A  (          118  33 RCL         168  2A  (
019  75 LOG         069  2A  (          119  9D  39         169  32 STO
020  3A  +          070  1B EE          120  2B  )          170  9E  40
021  B3 RC*         071  06  6          121  2A  (          171  3C  x
022  F5  00         072  31 INV         122  3A  +          172  01  1
023  31 INV         073  1B EE          123  33 RCL         173  03  3
024  76 INT         074  3A  +          124  9E  40         174  3D  /
025  3C  x          075  B3 RC*         125  64 X=T         175  02  2
026  33 RCL         076  F5  00         126  F6  01         176  75 LOG
027  9D  39         077  76 INT         127  96  32         177  3A  +
028  3B  -          078  3B  -          128  00  0          178  01  1
029  31 INV         079  2A  (          129  2B  )          179  2B  )
030  76 INT         080  3D  /          130  27 GTO         180  76 INT
031  B2 ST*         081  33 RCL         131  D8  66         181  73 EXC
032  F5  00         082  9D  39         132  2B  )          182  9D  39
033  3A  +          083  2B  )          133  03  3          183  26 RST
034  24 X:T         084  76 INT         134  31 INV
035  76 INT         085  3C  x          135  34 SUM
036  3C  x          086  24 X:T         136  9D  39
037  33 RCL         087  33 RCL         137  02  2
038  9D  39         088  9D  39         138  31 INV
039  2B  )          089  3A  +          139  74 PRD
040  3D  /          090  24 X:T         140  9D  39
041  06  6          091  F3 EX*         141  1B EE
042  31 INV         092  F5  00         142  05  5
043  75 LOG         093  31 INV         143  26 RST
044  3B  -          094  76 INT         144  29 LBL
045  76 INT         095  2B  )          145  10  A
046  3C  x          096  3C  x          146  6B CMS
047  24 X:T         097  07  7          147  76 INT
048  01  1          098  31 INV         148  77 IxI
049  2B  )          099  75 LOG         149  24 X:T
<\pre>

Some last notes about the programs

  • The largest number of digits of &PI the programs can calculate are:
    • .fo off
    • For the TI-59 version: 1287 digits.
    • For the TI-58 version: 507 digits.
    • For the TI-66 version: 494 digits. .fo on
  • The execution times for the largest possible input, based on about 200 iterations, are:
    • .fo off
    • Approximately 13 Days 12h 50' for the TI-59 version [1287 digits]
    • Approximately 2 Days 2h 40' for the TI-58 version [507 digits]
    • Approximately 7 Days 10h 10' for the TI-66 version [494 digits] .fo on
  • If you want to store the result on magnetic cards you can use this table to find out which banks you have to record:
  • .sk .fo off
    • 1 - 377 digits: Record bank 4 only.
    • 1 - 767 digits: Record banks 3 and 4.
    • 1 - 1157 digits: Record banks 2, 3 and 4.
    • 1 - 1287 digits: Record banks 1, 2, 3 and 4. .fo on
  • To use the programs in Normal Mode, you can press RST R/S R/S when the flashing 1 appears. This is useful when you want to SST through them or use them with a PC-100 in TRACE mode.