This program calculates "e" to 980 places and prints the result. The program was originally written by Bjorn Gustavsson and his version appeared in the newsletter of the Swedish club in\1980. [Programbiten 80-4, pages\5-6]
The version presented here has been changed slighty. Modifications include:
To obtain the high precision this program delivers, the following method is used: :lq
The program uses the well know summation of inverse factorials, that is: .sk .ce e = 1/0! + 1/1! + 1/2! + ...
Using this equation straight away would be very inefficient, because it would be required to calculate every term to the full amount of places needed. The solution to this problem is very simple, the summation is reversed and factored, that is: .sk .ce e = ...1/N] + 1]/ (N-1) + ..... + 1]/ 2 + 1]/ 1 + 1 .cp 12
The problem is now reduced to a simple division plus an addition of one. In a pseudo high-level language it could be written as: .sk
BEGIN N = 442 e = 1 DO WHILE N <> 0 e = e / N + 1 N = N - 1 END PRINT e END
In the program presented here, N is stored in R99 and e is stored in R98\[MSD] through R01\[LSD], and instead of adding\1, 1.E9 is added. :elq
The method described here is implemented in the program in steps 001-011 (the addition of 1.E9 and decrease of R99 (=N)) and steps 039-065 (the division over 98\registers).
The instructions for this version of the program are:
When the program has ended, the paper advances and directly after that the result, "e" to 980 places, is printed.
000 92 RTN 040 22 INV 080 00 0 120 00 0 001 01 1 041 52 EE 081 00 0 121 00 0 002 52 EE 042 52 EE 082 00 0 122 00 0 003 09 9 043 01 1 083 00 0 123 00 0 004 22 INV 044 00 0 084 00 0 124 00 0 005 52 EE 045 85 + 085 00 0 125 00 0 006 44 SUM 046 73 RC* 086 00 0 126 00 0 007 98 98 047 00 00 087 00 0 127 00 0 008 97 DSZ 048 75 - 088 00 0 128 00 0 009 99 99 049 53 ( 089 00 0 129 00 0 010 00 00 050 24 CE 090 00 0 130 00 0 011 32 32 051 55 ö 091 00 0 131 00 0 012 22 INV 052 43 RCL 092 00 0 132 00 0 013 49 PRD 053 99 99 093 00 0 133 00 0 014 98 98 054 54 ) 094 00 0 134 00 0 015 76 LBL 055 59 INT 095 00 0 135 00 0 016 15 E 056 72 ST* 096 00 0 136 00 0 017 50 IxI 057 00 00 097 00 0 137 00 0 018 09 9 058 65 x 098 00 0 138 76 LBL 019 08 8 059 43 RCL 099 00 0 139 11 A 020 42 STO 060 99 99 100 00 0 140 22 INV 021 00 00 061 54 ) 101 00 0 141 57 ENG 022 98 ADV 062 97 DSZ 102 00 0 142 22 INV 023 73 RC* 063 00 00 103 00 0 143 58 FIX 024 00 00 064 00 00 104 00 0 144 60 DEG 025 99 PRT 065 39 39 105 00 0 145 01 1 026 97 DSZ 066 61 GTO 106 00 0 146 00 0 027 00 00 067 00 00 107 00 0 147 69 OP 028 00 00 068 01 01 108 00 0 148 17 17 029 23 23 069 00 0 109 00 0 149 47 CMS 030 00 0 070 00 0 110 00 0 150 04 4 031 81 RST 071 00 0 111 00 0 151 04 4 032 43 RCL 072 00 0 112 00 0 152 03 3 033 99 99 073 00 0 113 00 0 153 42 STO 034 66 PAU 074 00 0 114 00 0 154 99 99 035 09 9 075 00 0 115 00 0 155 04 4 036 08 8 076 00 0 116 00 0 156 05 5 037 48 EXC 077 00 0 117 00 0 157 30 TAN 038 00 00 078 00 0 118 00 0 158 33 Xý 039 53 ( 079 00 0 119 00 0 159 86 STF <\pre>The TI-59 Version
User Instructions
The instructions for this version of the program are:
- Enter the program.
- Press A. The program will stop with a flashing\1 in the display.
- Now press 7 EE to start the program in Fast Mode.
- When the program has ended, the first 10 digits of e are in the display. The subsequent digits can be recalled by repeatedly pressing R/S. The end of the solution is indicated by a zero.
- To recall the entire result again, you can press E, once again followed by a lot of R/S'es.
Listing of the TI-59 Version
To obtain the listing for the TI-59 version, you only have to change steps 022-025 of the TI-59/PC-100 version into: .sk
022 73 RC* 023 00 00 024 99 PRT <-- This step is neccesary to stop a Fast Mode program! 025 91 R/SThe TI-58 Version
User Instructions
The user instructions for this version of the program are:
- Enter the Calculate Part of the program.
- Press A. The program will stop with a flashing\1 in the display.
- Now press 7 EE to start the program in Fast Mode.
- When the program has ended, you can enter the Read-out Part.
- The result can now be displayed by pressing E, repeatedly followed by R/S. The read-out is complete when a flashing zero appears.
Listing of the TI-58 Version [Calculate Part]
000 92 RTN 020 09 9 040 59 INT 060 11 A 001 01 1 021 08 8 041 72 ST* 061 22 INV 002 52 EE 022 48 EXC 042 00 00 062 57 ENG 003 09 9 023 00 00 043 65 x 063 22 INV 004 22 INV 024 53 ( 044 43 RCL 064 58 FIX 005 52 EE 025 22 INV 045 49 49 065 60 DEG 006 44 SUM 026 52 EE 046 54 ) 066 05 5 007 48 48 027 52 EE 047 97 DSZ 067 69 OP 008 97 DSZ 028 01 1 048 00 00 068 17 17 009 49 49 029 00 0 049 00 00 069 47 CMS 010 00 00 030 85 + 050 24 24 070 02 2 011 17 17 031 73 RC* 051 61 GTO 071 04 4 012 22 INV 032 00 00 052 00 00 072 06 6 013 49 PRD 033 75 - 053 01 01 073 42 STO 014 48 48 034 53 ( 054 00 0 074 49 49 015 00 0 035 24 CE 055 00 0 075 04 4 016 81 RST 036 55 ö 056 00 0 076 05 5 017 43 RCL 037 43 RCL 057 00 0 077 30 TAN 018 99 99 038 49 49 058 00 0 078 33 Xý 019 66 PAU 039 54 ) 059 76 LBL 079 86 STFListing of the TI-58 Version [Read-out Part]
000 76 LBL 005 48 EXC 010 97 DSZ 015 69 OP 001 15 E 006 00 00 011 00 00 016 68 68 002 50 IxI 007 73 RC* 012 00 00 017 92 RTN 003 04 4 008 00 00 013 07 07 004 08 8 009 91 R/S 014 00 0 <\pre>The TI-66 Version
User Instructions
The user instructions for this version of the program are:
- Set the partitioning to 63.55. [Part 56]
- Enter the calculate part of the program.
- Press A. The program will start directly.
- When the program has ended, you can enter the read-out program.
- The result can now be displayed by pressing E, repeatedly followed by R/S. The read-out is complete when a zero with nine decimal points appears.
Listing of the TI-66 Version [Calculate Part]
000 29 LBL 016 F6 01 032 2A ( 048 B2 ST* 001 10 A 017 8D 23 033 31 INV 049 F5 00 002 6B CMS 018 31 INV 034 1B EE 050 3C x 003 02 2 019 74 PRD 035 1B EE 051 33 RCL 004 07 7 020 CD 55 036 01 1 052 F6 01 005 01 1 021 00 0 037 00 0 053 2B ) 006 32 STO 022 A9 RTN 038 3A + 054 23 OP 007 F6 01 023 33 RCL 039 B3 RC* 055 94 30 008 01 1 024 F6 01 040 F5 00 056 65 DSZ 009 1B EE 026 05 5 041 3B - 057 F5 00 010 09 9 025 66 PAU 042 2A ( 058 94 30 011 31 INV 027 04 4 043 3D / 059 27 GTO 012 1B EE 028 73 EXC 044 33 RCL 060 F5 00 013 34 SUM 029 F5 00 045 F6 01 061 FD 08 014 CD 55 030 23 OP 046 2B ) 015 65 DSZ 031 8A 20 047 76 INTListing of the TI-66 Version [Read-out Part]
000 29 LBL 005 F5 00 010 B3 RC* 015 80 10 001 18 E 006 05 5 011 F6 01 016 00 0 002 05 5 007 05 5 012 25 R/S 017 36 1/X 003 04 4 008 32 STO 013 65 DSZ 018 A9 RTN 004 32 STO 009 F6 01 014 F5 00 <\pre>Some last notes about the programs