The Museum of HP Calculators

HP Forum Archive 19

Happy Pi Day
Message #1 Posted by Egan Ford on 14 Mar 2009, 12:09 p.m.

For the last few weekends I have been exploring faster and faster ways to compute Pi to 1000 digits on the 71B. The 71B is an incredible machine. I am always amazed at what this little hand-held computer can do.

If you are more interested in newer calculators, then check out my 50g Pi programs:

NOTE: This is a subset of a larger article I will finish someday. I will have more results, hopefully before the next Pi day (22/7).

## Draft

Subject: 1000 Digits of Pi on Pre-1990 Hand-Held Calculators and Computers

The genesis of this article originated with the following statement from Gene Wright, "Looks like the race to 1000 digits on a machine prior to 1990 now belongs to TI? Can we beat the 5.81 hours on the TI95 with the HP71B?" (http://www.hpmuseum.org/cgi-sys/cgiwrap/hpmuseum/archv014.cgi?read=53988)

As of early 2009 this challenge has remained unanswered--until now...

I've spent the last few weekends exploring various ways to meet this challenge. The most amazing result is Ron Knapp's RPN code running on the 71B (entry 5). The quest to best 5.81 hours could have ended in 1985 with a HP-41 Translator Pac equipped 71B!

```
```
```   Algorithm      Platform  Language  Memory  Digits  Time(s)
-------------  --------  --------  ------  ------  -------
1. Atan Stormer1  HP-71B    Forth     3360 B    1002     3172 (0.88 hr) (53.87 min)
2. Atan Stormer   HP-71B    Forth     3360 B    1002     3434 (0.95 hr) (57.23 min)
3. Atan Machin1   HP-71B    Forth     3360 B    1003     3561 (0.99 hr) (59.35 min)
4. Atan Machin    HP-71B    Forth     3360 B    1003     3825 (1.06 hr) (63.75 min)
5. Atan Machin2   HP-71B    RPN       220 R?    1001     6034 (1.68 hr)
6. Spigot         HP-71B    Forth     17.1 K    1002     6720 (1.87 hr)
7. Atan Machin3   TI-95     AOS                 1001   ~20916 (5.81 hr)
8. Atan Machin2   HP-41CX   RPN       1540 B    1001   ~30600 (8.50 hr)
```
11000 decimal digits represented as base 220. 2Ron Knapp implementation. 3Bob Fruit implementation.

Table 1 Summary of Results < 9 Hours

```
```
Entries 1 and 3 are the same as 2 and 4 respectively, just timed differently. All four were computed base 220 to get the most out of the 20-bit Saturn architecture, however entries 1 and 3 stopped the clock after 168 base 220 digits were computed, whereas entries 2 and 4 stopped the clock after the number was converted to base 10. Since it takes ~3.5 minutes just to display the results and without any clear rules on the subject I opted to report both. I expect that most will agree that 1000 decimal digits of Pi must be represented as 1000 decimal digits making entry 2 the fasted pre-1990 hand-held leader.

Entries 5 and 8 are based on Ron Knapp's original program published in 1981 (V8N6P69 of the PPC Calculator Journal).

## Output and Code

1. HP-71B Arctan Forth
2. HP-71B Spigot Forth
3. HP-71B Arctan RPN
4. TI-95 Arctan AOS
5. HP-41CX Arctan RPN

1. HP-71B Arctan Forth

Output of entries 2 and 4 (1 and 3 are the same but have different times reported. (see above)):

```3.
141592653589793238462643383279502884197169399375105820974944592307816406286208
998628034825342117067982148086513282306647093844609550582231725359408128481117
450284102701938521105559644622948954930381964428810975665933446128475648233786
783165271201909145648566923460348610454326648213393607260249141273724587006606
315588174881520920962829254091715364367892590360011330530548820466521384146951
941511609433057270365759591953092186117381932611793105118548074462379962749567
351885752724891227938183011949129833673362440656643086021394946395224737190702
179860943702770539217176293176752384674818467669405132000568127145263560827785
771342757789609173637178721468440901224953430146549585371050792279689258923542
019956112129021960864034418159813629774771309960518707211349999998372978049951
059731732816096318595024459455346908302642522308253344685035261931188171010003
137838752886587533208381420617177669147303598253490428755468731159562863882353
787593751957781857780532171226806613001927876611195909216420198938
```
```TIME: 3824.81 SEC
```
```3.
141592653589793238462643383279502884197169399375105820974944592307816406286208
998628034825342117067982148086513282306647093844609550582231725359408128481117
450284102701938521105559644622948954930381964428810975665933446128475648233786
783165271201909145648566923460348610454326648213393607260249141273724587006606
315588174881520920962829254091715364367892590360011330530548820466521384146951
941511609433057270365759591953092186117381932611793105118548074462379962749567
351885752724891227938183011949129833673362440656643086021394946395224737190702
179860943702770539217176293176752384674818467669405132000568127145263560827785
771342757789609173637178721468440901224953430146549585371050792279689258923542
019956112129021960864034418159813629774771309960518707211349999998372978049951
059731732816096318595024459455346908302642522308253344685035261931188171010003
137838752886587533208381420617177669147303598253490428755468731159562863882353
787593751957781857780532171226806613001927876611195909216420198937
```
```TIME: 3433.92 SEC
```

Code:

```: PIATAN ;
```
```79 6 / CONSTANT MAXL
1002 CONSTANT N
N 6 / 1 + CONSTANT M
5 CONSTANT S
M S * CONSTANT E
CREATE A E NALLOT
CREATE B E NALLOT
CREATE XX E NALLOT
CREATE YY E NALLOT
VARIABLE D
VARIABLE F
VARIABLE FF
VARIABLE G
VARIABLE H
```
```: 1D. <# # #> TYPE ;
: 06D. <# # # # # # # #> TYPE ;
: MPSET OVER ! DUP E + SWAP S + DO 0 I ! S +LOOP ;
: MPCOPY 2DUP - SWAP DUP E + SWAP DO I @ OVER I + ! S +LOOP 2DROP ;
: UD+ ROT + ROT ROT + ;
```
```: MPDIV
D ! DUP DUP M 0 DO DUP @ 0= IF S + ELSE LEAVE THEN LOOP DUP E - ROT = IF 2DROP 0 ELSE
0 SWAP ROT E + SWAP DO I @ SWAP D @ UM/MOD I ! S +LOOP DROP 1 THEN
;
```
```: MPMULT
D ! DUP DUP E + S - M 0 DO DUP @ 0= IF S - ELSE LEAVE THEN LOOP > IF DROP ELSE
0 SWAP DUP E + S - DO I @ D @ UM* ROT 0 D+ SWAP I ! S NEGATE +LOOP DROP THEN
;
```
```: MPSUB
2DUP - D !
0 SWAP DUP E + S - DO I D @ + DUP H ! @ 0 I @ 0 D- ROT 0 UD+ H @ !
S NEGATE +LOOP
2DROP
;
```
```: MPADD
2DUP - D !
0 SWAP DUP E + S - DO I D @ + DUP H ! @ 0 I @ 0 D+ ROT 0 D+ SWAP H @ !
S NEGATE +LOOP
2DROP
;
```
```: MPATAN
F ! G ! 1 FF ! XX 1 MPSET XX F @ MPDIV DROP G @ XX MPCOPY
F @ 1024 < IF F @ DUP * F ! 0 FF ! THEN
1 BEGIN
2 + XX F @ MPDIV DROP
FF @ 1 = IF XX F @ MPDIV DROP THEN
YY XX MPCOPY DUP YY SWAP MPDIV 1 =
WHILE
DUP 2 AND 0 > IF G @ YY MPSUB ELSE G @ YY MPADD THEN
REPEAT
DROP
;
```
```: MPPRINT
XX SWAP MPCOPY XX @ 0 1D. ." ." CR
N 0 DO
0 XX ! XX 1000000 MPMULT XX @ 0 06D.
I 6 / 1 + MAXL MOD 0= IF CR THEN
6 +LOOP
;
```
```: MACHIN
A 5 MPATAN A 16 MPMULT
B 239 MPATAN B 4 MPMULT A B MPSUB
;
```
```: STORMER
A 57 MPATAN A 176 MPMULT
B 239 MPATAN B 28 MPMULT A B MPADD
B 682 MPATAN B 48 MPMULT A B MPSUB
B 12943 MPATAN B 96 MPMULT A B MPADD
;
```
```: DOIT
CLOCK MACHIN A MPPRINT CR CLOCK
CR ." TIME: " X<>Y F- STD F. ." SEC" CR CR
```
```  CLOCK STORMER A MPPRINT CR CLOCK
CR ." TIME: " X<>Y F- STD F. ." SEC" CR
;
```

2. HP-71B Spigot Forth

```314159265358979323846264338327950288419716939937510582097494459230781640628620
899862803482534211706798214808651328230664709384460955058223172535940812848111
745028410270193852110555964462294895493038196442881097566593344612847564823378
678316527120190914564856692346034861045432664821339360726024914127372458700660
631558817488152092096282925409171536436789259036001133053054882046652138414695
194151160943305727036575959195309218611738193261179310511854807446237996274956
735188575272489122793818301194912983367336244065664308602139494639522473719070
217986094370277053921717629317675238467481846766940513200056812714526356082778
577134275778960917363717872146844090122495343014654958537105079227968925892354
201995611212902196086403441815981362977477130996051870721134999999837297804995
105973173281609631859502445945534690830264252230825334468503526193118817101000
313783875288658753320838142061717766914730359825349042875546873115956286388235
378759375195778185778053217122680661300192787661119590921642019893
```
```TIME: 6720.22 SEC
```

Code:

```: SPIGOT ;
```
```: 06D. <# # # # # # # #> TYPE ;
```
```79 6 / CONSTANT MAXL
1002 CONSTANT N
N 6 / 21 * CONSTANT M
5 CONSTANT S
CREATE A M S * NALLOT
1000000 CONSTANT F
VARIABLE E
VARIABLE K
VARIABLE P
```
```: SPIGOTM
1 K !
0,
```
```  1 M 1 - DO
I SWAP OVER UM* SWAP 2SWAP UM* D+
200000000000, D+
I 2* 1 - M/MOD
ROT A I S * + !
-1 +LOOP
F M/MOD 06D.
DUP E ! 0
```
```  0 M 22 - DO
1 I DO
I SWAP OVER UM* SWAP 2SWAP UM* D+
A I S * + DUP P ! @ F UM* D+
I 2* 1 - M/MOD
ROT P @ !
-1 +LOOP
F M/MOD E @ 0 D+ 06D.
DUP E ! 0
1 K +! K @ MAXL MOD 0= IF CR THEN
-21 +LOOP
```
```  2DROP
;
```
```: DOIT
CLOCK SPIGOTM CLOCK
CR CR ." TIME: " X<>Y F- STD F. ." SEC" CR
;
```

3. HP-71B Arctan RPN

This was originally written by Ron Knapp for the 41. Minor changes were made to address output formatting and timing.

Output:

```3.141592653589793238462643383279502884197169399375105820974944592307816406286208
99862803482534211706798214808651328230664709384460955058223172535940812848111745
02841027019385211055596446229489549303819644288109756659334461284756482337867831
65271201909145648566923460348610454326648213393607260249141273724587006606315588
17488152092096282925409171536436789259036001133053054882046652138414695194151160
94330572703657595919530921861173819326117931051185480744623799627495673518857527
24891227938183011949129833673362440656643086021394946395224737190702179860943702
77053921717629317675238467481846766940513200056812714526356082778577134275778960
91736371787214684409012249534301465495853710507922796892589235420199561121290219
60864034418159813629774771309960518707211349999998372978049951059731732816096318
59502445945534690830264252230825334468503526193118817101000313783875288658753320
83814206171776691473035982534904287554687311595628638823537875937519577818577805
321712268066130019278766111959092164201989
```
```TIME: 6033.60 SEC
```

Code (use RUN TRANS41 to input):

```LBL "CPI2"      X<0?            R^              ST* T           RCL 05
CLRG            +               ST+ T           ST* Z           +
219             RCL 01          X^2             *               DSE Y
STO 00          RCL 04          R^              RCL 08          LBL 14
TIME            ST/ Z           +               *               STO IND 00
HR              *               +               FRC             RDN
STO IND 00      ENTER^          FC? 00          X<>Y            DSE 03
FIX 03          LBL 99          GTO 04          LASTX           DSE 00
4               RCL 08          RCL 13          INT             GTO 13
STO 09          ST/ Z           *               R^              219
1E5             MOD             3               +               STO 00
ST/ Y           R^              DSE 02          RCL 05          TIME
STO 04          INT             GTO 05          -               HR
X^2             LASTX           LBL 04          +               RCL IND 00
STO 05          FRC             RCL 07          X>0?            -
X<>Y            RDN             *               ISG IND 00      STO IND 00
427             +               RCL 06          X>0?            LBL E
+               X<>Y            LBL 05          GTO 11          SF 21
STO 02          INT             X<>Y            RCL 05          CLA
239             RCL 04          RDN             +               FIX 00
X^2             ST* T           /               LBL 11          14.114
STO 07          ST* Z           STO 01          ISG 00          STO 00
LASTX           *               CLX             GTO 10          SF 29
1E2             STO IND 00      R^              GTO J           RCL IND 00
*               RDN             ENTER^          LBL 09          ACX
STO 13          ENTER^          GTO 06          RCL 03          STD
RDN             LBL 99          LBL 07          STO 00          CF 29
X^2             RCL 08          RCL 01          RCL 10          ISG 00
STO 08          ST/ Z           ST/ Z           X^2             LBL 15
94E-5           MOD             MOD             3               XEQ 16
STO 11          X<>Y            X<>Y            Y^X             ISG 00
14.0139         INT             INT             LASTX           FS? 00
STO 12          ST+ IND 00      X<>Y            *               GTO 17
25              RDN             RCL 04          STO 08          XEQ 16
STO 10          +               ST* Z           CLX             CLA
LBL 00          STO 01          *               LBL 12          ISG 00
RCL 11          RCL 03          ENTER^          RCL IND 00      GTO 15
ST+ 12          RCL 04          LBL 06          X<>Y            ACA
RCL 12          *               RCL 01          RCL 04          GTO 17
RND             ENTER^          ST/ Z           ST/ Z           LBL 16
STO 00          ISG 00          MOD             *               RCL IND 00
RCL 07          GTO 02          RDN             ENTER^          RCL 04
RCL 02          DSE 02          INT             LBL 99          /
INT             GTO 00          +               RCL 08          INT
ENTER^          4096E-7         RCL IND 00      ST/ Z           LASTX
ST* Z           STO 08          -               MOD             FRC
2               1439.00006      X>0?            R^              RCL 04
-               STO 02          GTO 08          INT             XEQ 18
ST- Z           837E-6          DSE 00          LASTX           XEQ 18
*               STO 11          LBL 99          FRC             RTN
RCL 10          115.115         DSE IND 00      RDN             LBL 18
*               STO 12          ISG 00          +               *
STO 06          80              RCL 05          X<>Y            RCL Y
CLX             STO 13          +               INT             X=0?
STO 01          5E6             LBL 08          RCL 04          GTO 19
X<>Y            STO 07          STO IND 00      ST* T           LOG
RCL 13          .75             R^              ST* Z           INT
*               STO 06          RCL 04          *               LBL 19
ENTER^          LBL J           *               STO IND 00      RCL 09
GTO 01          RCL 11          ENTER^          RDN             X<>Y
LBL 02          ST+ 12          ISG 00          ENTER^          X=Y?
RCL 06          RCL 12          GTO 07          LBL 99          GTO 20
ST/ Z           RND             RCL 03          RCL 08          -
MOD             STO 00          STO 00          ST/ Z           0
X<>Y            STO 03          FS?C 00         MOD             LBL 21
INT             SF 00           GTO 03          X<>Y            ARCL X
X<>Y            LBL 03          CLX             INT             DSE Y
RCL 04          RCL 02          ENTER^          ST+ IND 00      GTO 21
ST* Z           INT             DSE 02          RDN             LBL 20
*               ENTER^          FS? 00          +               ARCL T
ENTER^          ENTER^          GTO 09          ISG 00          ACA
LBL 01          LBL 99          LBL 10          GTO 12          CLA
RCL 06          2               X<> IND 00      114.013         RTN
ST/ Z           -               RCL 04          STO 00          LBL 17
MOD             ST* Z           /               215             ADV
STO 03          RCL 10          FRC             STO 03          ADV
RDN             ST* Z           LASTX           CLX             219
INT             X<>Y            INT             LBL 13          STO 00
+               *               RCL 08          RCL IND 03      RCL IND 00
RCL 05          2               *               +               3600
ST- Y           ST- L           FRC             RCL IND 00      *
X<>Y            CLX             LASTX           -               FIX 02
RCL IND 00      LASTX           INT             0               "TIME: "
+               ST* T           ST+ IND 00      X<>Y            ARCL X
X>0?            ST- Y           RDN             X<0?            "} SEC"
ISG 01          RDN             X<>Y            X>0?            PRA
LBL 99          *               RCL 05          GTO 14          END
```

4. TI-95 Arctan AOS

Code:

5. HP-41CX Arctan RPN

This was originally written by Ron Knapp. Minor changes were made to address output formatting, timing, and duplicate labels (labels were changed to increase readability).

NOTE: The timing was from EMU41, the orginal time was ~8.5 hours. The final article will have a 41CX retiming.

Output:

```3.
14159 26535 89793 23846
26433 83279 50288 41971
69399 37510 58209 74944
59230 78164 06286 20899
86280 34825 34211 70679
82148 08651 32823 06647
09384 46095 50582 23172
53594 08128 48111 74502
84102 70193 85211 05559
64462 29489 54930 38196
44288 10975 66593 34461
28475 64823 37867 83165
27120 19091 45648 56692
34603 48610 45432 66482
13393 60726 02491 41273
72458 70066 06315 58817
48815 20920 96282 92540
91715 36436 78925 90360
01133 05305 48820 46652
13841 46951 94151 16094
33057 27036 57595 91953
09218 61173 81932 61179
31051 18548 07446 23799
62749 56735 18857 52724
89122 79381 83011 94912
98336 73362 44065 66430
86021 39494 63952 24737
19070 21798 60943 70277
05392 17176 29317 67523
84674 81846 76694 05132
00056 81271 45263 56082
77857 71342 75778 96091
73637 17872 14684 40901
22495 34301 46549 58537
10507 92279 68925 89235
42019 95611 21290 21960
86403 44181 59813 62977
47713 09960 51870 72113
49999 99837 29780 49951
05973 17328 16096 31859
50244 59455 34690 83026
42522 30825 33446 85035
26193 11881 71010 00313
78387 52886 58753 32083
81420 61717 76691 47303
59825 34904 28755 46873
11595 62863 88235 37875
93751 95778 18577 80532
17122 68066 13001 92787
66111 95909 21642 01989
```
```TIME: 32.51 SEC
```

Code:

``` 01 LBL "CPI2"      111 STO IND 00      221 X>0?            331 +
02 CLRG            112 RDN             222 GTO 09          332 ISG 00
03 219             113 ENTER           223 DSE 00          333 GTO 13
04 STO 00          114 LBL 99          224 LBL 99          334 114.013
05 TIME            115 RCL 08          225 DSE IND 00      335 STO 00
06 HR              116 ST/ Z           226 ISG 00          336 215
07 STO IND 00      117 MOD             227 RCL 05          337 STO 03
08 FIX 03          118 X<>Y            228 +               338 CLX
09 4               119 INT             229 LBL 09          339 LBL 14
10 STO 09          120 ST+ IND 00      230 STO IND 00      340 RCL IND 03
11  E5             121 RDN             231 R^              341 +
12 ST/ Y           122 +               232 RCL 04          342 RCL IND 00
13 STO 04          123 STO 01          233 *               343 -
14 X^2             124 RCL 03          234 ENTER           344 0
15 STO 05          125 RCL 04          235 ISG 00          345 X<>Y
16 X<>Y            126 *               236 GTO 08          346 X<0?
17 427             127 ENTER           237 RCL 03          347 X>0?
18 +               128 ISG 00          238 STO 00          348 GTO 15
19 STO 02          129 GTO 03          239 FS?C 00         349 RCL 05
20 239             130 DSE 02          240 GTO 04          350 +
21 X^2             131 GTO 01          241 CLX             351 DSE Y
22 STO 07          132 4096 E-7        242 ENTER           352 LBL 15
23 LASTX           133 STO 08          243 DSE 02          353 STO IND 00
24  E2             134 1439.00006      244 FS? 00          354 RDN
25 *               135 STO 02          245 GTO 10          355 DSE 03
26 STO 13          136 837 E-6         246 LBL 11          356 DSE 00
27 RDN             137 STO 11          247 X<> IND 00      357 GTO 14
28 X^2             138 115.115         248 RCL 04          358 219
29 STO 08          139 STO 12          249 /               359 STO 00
30 94 E-5          140 80              250 FRC             360 TIME
31 STO 11          141 STO 13          251 LASTX           361 HR
32 14.0139         142 5 E6            252 INT             362 RCL IND 00
33 STO 12          143 STO 07          253 RCL 08          363 -
34 25              144 .75             254 *               364 STO IND 00
35 STO 10          145 STO 06          255 FRC             365 RTN
36 LBL 01          146 LBL J           256 LASTX           366 LBL E
37 RCL 11          147 RCL 11          257 INT             367 SF 21
38 ST+ 12          148 ST+ 12          258 ST+ IND 00      368 CLA
39 RCL 12          149 RCL 12          259 RDN             369 FIX 00
40 RND             150 RND             260 X<>Y            370 14.114
41 STO 00          151 STO 00          261 RCL 05          371 STO 00
42 RCL 07          152 STO 03          262 ST* T           372 SF 29
43 RCL 02          153 SF 00           263 ST* Z           373 RCL IND 00
44 INT             154 LBL 04          264 *               374 ARCL X
45 ENTER           155 RCL 02          265 RCL 08          375 ACA
46 ST* Z           156 INT             266 *               376 CLA
47 2               157 ENTER           267 FRC             377 PRBUF
48 -               158 ENTER           268 X<>Y            378 CF 29
49 ST- Z           159 LBL 99          269 LASTX           379 ISG 00
50 *               160 2               270 INT             380 LBL 16
51 RCL 10          161 -               271 R^              381 XEQ 17
52 *               162 ST* Z           272 +               382 ISG 00
53 STO 06          163 RCL 10          273 RCL 05          383 FS? 00
54 CLX             164 ST* Z           274 -               384 GTO 18
55 STO 01          165 X<>Y            275 +               385 " "
56 X<>Y            166 *               276 X>0?            386 XEQ 17
57 RCL 13          167 2               277 ISG IND 00      387 PRBUF
58 *               168 ST- L           278 X>0?            388 CLA
59 ENTER           169 CLX             279 GTO 12          389 ISG 00
60 GTO 02          170 LASTX           280 RCL 05          390 GTO 16
61 LBL 03          171 ST* T           281 +               391 AVIEW
62 RCL 06          172 ST- Y           282 LBL 12          392 GTO 18
63 ST/ Z           173 RDN             283 ISG 00          393 LBL 17
64 MOD             174 *               284 GTO 11          394 RCL IND 00
65 X<>Y            175 R^              285 GTO J           395 RCL 04
66 INT             176 ST+ T           286 LBL 10          396 /
67 X<>Y            177 X^2             287 RCL 03          397 INT
68 RCL 04          178 R^              288 STO 00          398 LASTX
69 ST* Z           179 +               289 RCL 10          399 FRC
70 *               180 +               290 X^2             400 RCL 04
71 ENTER           181 FC? 00          291 3               401 XEQ 19
72 LBL 02          182 GTO 05          292 Y^X             402 " "
73 RCL 06          183 RCL 13          293 LASTX           403 XEQ 19
74 ST/ Z           184 *               294 *               404 RTN
75 MOD             185 3               295 STO 08          405 LBL 19
76 STO 03          186 DSE 02          296 CLX             406 *
77 RDN             187 GTO 06          297 LBL 13          407 RCL Y
78 INT             188 LBL 05          298 RCL IND 00      408 X=0?
79 +               189 RCL 07          299 X<>Y            409 GTO 20
80 RCL 05          190 *               300 RCL 04          410 LOG
81 ST- Y           191 RCL 06          301 ST/ Z           411 INT
82 X<>Y            192 LBL 06          302 *               412 LBL 20
83 RCL IND 00      193 X<>Y            303 ENTER           413 RCL 09
84 +               194 RDN             304 LBL 99          414 X<>Y
85 X>0?            195 /               305 RCL 08          415 X=Y?
86 ISG 01          196 STO 01          306 ST/ Z           416 GTO 21
87 LBL 99          197 CLX             307 MOD             417 -
88 X<0?            198 R^              308 R^              418 0
89 +               199 ENTER           309 INT             419 LBL 22
90 RCL 01          200 GTO 07          310 LASTX           420 ARCL X
91 RCL 04          201 LBL 08          311 FRC             421 DSE Y
92 ST/ Z           202 RCL 01          312 RDN             422 GTO 22
93 *               203 ST/ Z           313 +               423 LBL 21
94 ENTER           204 MOD             314 X<>Y            424 ARCL T
95 LBL 99          205 X<>Y            315 INT             425 ACA
96 RCL 08          206 INT             316 RCL 04          426 CLA
97 ST/ Z           207 X<>Y            317 ST* T           427 RTN
98 MOD             208 RCL 04          318 ST* Z           428 LBL 18
99 R^              209 ST* Z           319 *               429 219
100 INT             210 *               320 STO IND 00      430 STO 00
101 LASTX           211 ENTER           321 RDN             431 RCL IND 00
102 FRC             212 LBL 07          322 ENTER           432 3600
103 RDN             213 RCL 01          323 LBL 99          433 *
104 +               214 ST/ Z           324 RCL 08          434 FIX 02
105 X<>Y            215 MOD             325 ST/ Z           435 "TIME: "
106 INT             216 RDN             326 MOD             436 ARCL X
107 RCL 04          217 INT             327 X<>Y            437 >" SEC"
108 ST* T           218 +               328 INT             438 PRA
109 ST* Z           219 RCL IND 00      329 ST+ IND 00      439 END
110 *               220 -               330 RDN
```

Edited: Minor bug in PIATAN Forth that may have left a value on the stack after run. Results and time unaffected, just clean up.

Edited: Removed TI-59 article.

Edited: 19 Mar 2009, 9:26 a.m. after one or more responses were posted

 Re: Happy Pi DayMessage #2 Posted by Katie Wasserman on 15 Mar 2009, 11:04 a.m.,in response to message #1 by Egan Ford Egan, Wow, you've been a busy guy! I need some time to digest all this, but thank you for all your work on Vieta Accelerated. I didn't know about Kreminski's formula, very interesting. -Katie

 Re: Happy Pi DayMessage #3 Posted by Palmer O. Hanson, Jr. on 15 Mar 2009, 10:39 p.m.,in response to message #1 by Egan Ford Egan: The article that you included with the TI-95 program was originally published as part of the documentation of a TI-59 program on V7N4/5P27-29 of TI PPC Notes back in mid-1982. You can access that at Viktor Toth's site. The procedures described for running the TI-59 program do not apply to the TI-95 program. There is also an error in the article where it states "... There is a linear relationship between the number of decimal places and the running time of the program. ..." Actually, the relationship should be, and usually is very close to a squared relationship. The material in TI PPC Notes includes the TI-59 program. Unfortunately, the program listing is incomplete in that the first forty steps of program II-B are missing. If anyone would like to run the TI-59 program I can provide a listing of the missing steps. The TI-59 program is limited to 460 digits by memory limitations. There was a program published in the French magazine Science et Vie which was substatially slower but which would find 1287 digits of pi. That is particularly impressive since the TI-59's user memory is only 1300 digits. Palmer

 Re: Happy Pi DayMessage #4 Posted by Egan Ford on 16 Mar 2009, 10:50 a.m.,in response to message #3 by Palmer O. Hanson, Jr. Palmer, I was a bit confused myself about the pairing of that article and the source. They were sent to me as a single 3 page PDF. I've removed the article to avoid any ambiguity. Do you have any links, articles, etc... about the TI-95 Pi program and its 5.81 hour result? Any corroborating or anecdotal information would be great. Thanks.

 Re: Happy Pi DayMessage #5 Posted by Marcus von Cube, Germany on 16 Mar 2009, 11:45 a.m.,in response to message #4 by Egan Ford Could you please repost the link to the removed TI-59 article? My former printout of your post is incomplete and I'd like to read the document. Marcus

 Re: Happy Pi DayMessage #6 Posted by Egan Ford on 16 Mar 2009, 12:16 p.m.,in response to message #5 by Marcus von Cube, Germany Here is the original PDF that was sent to me. It is higher resolution than the images posted here (MoHPC size limitation).

 Re: Happy Pi DayMessage #7 Posted by Marcus von Cube, Germany on 17 Mar 2009, 4:08 a.m.,in response to message #6 by Egan Ford Hi Egan, thanks for the download. I might have caught the PI disease. Marcus

 Re: Happy Pi DayMessage #8 Posted by Egan Ford on 17 Mar 2009, 7:44 a.m.,in response to message #7 by Marcus von Cube, Germany I do not find the number Pi that interesting. A handful of digits can solve many practical problems. E.g. with less than 100 digits you can calculate the circumference of the universe accurate to the radius of a hydrogen atom. What I find interesting is all the different math that can be applied to computing Pi. And, what I find most interesting is the computational methods used to compute Pi, especially on machines with limited resources. As I explore this history I am truly amazed at the ingenuity and determination of the individual programmers. Especially the TI programmers. AFAIK, the 41 and 71 outclass the 59 and 95 in terms of I/O and memory forcing the TI community to think smarter. Fascinating!

 Re: Happy Pi DayMessage #9 Posted by Palmer O. Hanson, Jr. on 16 Mar 2009, 11:25 p.m.,in response to message #4 by Egan Ford Egan: You wrote: Quote: Do you have any links, articles, etc... about the TI-95 Pi program and its 5.81 hour result? Any corroborating or anecdotal information would be great. The following notes accompanied my transmission of the TI-95 program to Gene Wright: Quote: 1. A direct translation would yield bad results if the number of digits asked for was greater than 770. I "fixed" it by changing from using ten digit registers with only the three guard digits available for carries from one register to the next to using nine digit registers with four digits available for the carries. The completed program is a hybrid which uses ten digit registers for up to 770 digits and nine digits for more than 770 digits. This yields about a ten per cent increase in speed for requests for less than 770 digits. Flag 3 controls whether 9 or 10 digit registers are used. 2. It would have been possible to simply print out the nine digit registers, but that made it difficult to check the answers against my pi table which was printed in groups of ten digits so I added a routine at the end which will either print or display the nine digit registers in a ten digit format. I could have used the same routine in another way to simply rearrange the 9 digit information back into the registers as 10 digit information but I didn't. 3. The TI-59 proram used two HIR registers to save two data registers for the calculation. My conversion replaced HIR 07 with data register 470 and HIR 08 with data register 471. 4. The TI-95 does not permit comparisons with the t register without using assembly language techniques. My conversion used data register 472 as a comparison register. Where the t register was used only as a place to park a value for later recovery I used the TI-95 t register as at lines 0408 and 0415. 5. I also used data register 474 to store the number of places desired and data register 473 to store the number of data registers to be used for the number of places desired. 6. In Bob's discussion of his program he says that "There is a linear relationship between the number of decimal places and the running time of the programs." Actually, the relationship is essentially a square relationship with an upward tail at the low end driven by the initialization routines and by the initializations for each iteration. You can see that in the plots. That is all the supporting documentation that there is other than my handwritten programming notes and some run time results where the run time results are included in the graph that accompanied the transmission to Gene. Some years ago I assembled a fairly thorough summary of the work with pi on the TI-59 including references to TI PPC Notes for details. It runs several pages. If you send an e-mail address I will send it to you. Palmer

 Re: Happy Pi DayMessage #10 Posted by Egan Ford on 17 Mar 2009, 7:29 a.m.,in response to message #9 by Palmer O. Hanson, Jr. Thank you very much. I find all of this history very interesting. You've got mail.

Go back to the main exhibit hall