CLEAR STORAGE 1     ,008015,022026,030037,044,049,053053N000000N00001026                                         1
 CLEAR STORAGE 2     L068116,105106,110117B101/I9I#071029C029056B026/B001/0991,001/001117I0?                      2
 BOOTSTRAP           ,008015,022029,036040,047054,061068,072/061039              ,0010011040                      3
0                                                                                                         PAGE    1
0 SEQ PG LIN  LABEL  OP    OPERANDS                                            SFX CT  LOCN  INSTRUCTION TYPE  CARD
 
  101         *   1         2         3         4         5         6         7         8
  102         *78901234567890123456789012345678901234567890123456789012345678901234567890
  103         * LABEL   | OP | OPERATION                                         |XXXXXXX
1                               SUBROUTINE  PI                                                            PAGE    2
0 SEQ PG LIN  LABEL  OP    OPERANDS                                            SFX CT  LOCN  INSTRUCTION TYPE  CARD
 
  104                JOB        SUBROUTINE  PI
  105         * LETS GO FOR 8,000 CHARACTERS OF MEMORY
  106         * SO - WE HAVE 2,000 VALID PI CHARACTERS ? :-))
  107         * NOW LETS PRETTY IT UP A BIT, ORGANIZE SUBROUTINES
  108         *   CALL A SUBROUTINE DEPENDS UPON
  109         *       IF THE INDEX REGISTER OPTION IS INSTALLED,
  110         *            ANY BRANCH LEAVES THE ADDRESS OF THE NEXT SEQUENTIAL
  111         *                  INSTRUCTION IF THE BRANCH NOT TAKEN IN THE
  112         *                  B ADDRESS REGISTER   :-))
  113         *     THE ARCTAN ROUTINE IS WRITTEN AS A SUBROUTINE.
  114         *
  115                CTL        6611  *6=16,000C;6=16,000T;1=OBJDECK;,1=MODADD
  116         *   1         2         3         4         5         6         7         8
  117         *78901234567890123456789012345678901234567890123456789012345678901234567890
  118         * LABEL   | OP | OPERATION                                         |XXXXXXX
  119                ORG   87                                                                 0087
  120         X1     DSA   0                  INDEX REGISTER 1                      3  0089  000                  4
  121                ORG   92                                                                 0092
  122 *       X2     DSA   0                  INDEX REGISTER 2                      3  0094  000                  5
  123 *              ORG   97                                                                 0097
  124 *       X3     DSA   0                  INDEX REGISTER 3                      3  0099  000                  6
  125         *
  126         * START STORAGE AREAS
  127         *  SMALL AREAS
  128 *              ORG   100     * PUT SMALL STUFF IN PUNCH AREA                            0100
  129         ITCNT  DCW   000000    * ITERATION COUNTER, STARTS AT ZERO            6  0105                       6
  130         DIVBAS DCW   000000   * DIVISOR FOR BASET                             6  0111                       6
  131         IX2P1  DCW   000000   * ITCNT TIMES 2 PLUS 1, DIVISOR FOR INTER       6  0117                       6
  132         C0     DCW   000000                                                   6  0123                       6
  133         C1     DCW   000001                                                   6  0129                       6
  134         C2     DCW   000002                                                   6  0135                       6
  135         C25    DCW   000025  * 5^2                                            6  0141                       7
  136         C239P2 DCW   057121  * 239^2                                          6  0147                       7
  137         CNTZRO DCW   000000  * COUNT LEADING ZEROS, DONE YET?                 6  0153                       7
  138         CF     DCW   1         *  "1"=ADD, "0" OR OTHER = SUBTRACT            1  0154                       7
  139         LC0L9  DCW   000000000                                                9  0163                       7
  140         *
  141         *    COMPUTE    16*ARCTAN(1/5)
  142         START  MCW   @+@,ACCUM&2049   * ZERO ACCUMULATOR, FORCE POSITIVE      7  0164  M R5/ R5'            7
  143                MCW   @0@,ACCUM&2048                                           7  0171  M R5S R4Z            8
  144                B     START1           * SKIP PRINT AREA                       4  0178  B 335                8
  145                ORG   335                                                                0335
  146         START1 MCW   ACCUM&2048,ACCUM&2047                                    7  0335  M R4Z R4Y            9
  147                MCW   @0@,BASET&2048  * ZERO BASE                              7  0342  M R5S Q49            9
  148                MCW   BASET&2048,BASET&2047                                    7  0349  M Q49 Q48            9
  149         * BIG REGISTERS SET
  150                MCW   @80@,BASET&8  * SET A HIGH ORDER TO 1*5*16               7  0356  M R5U 809            9
  151                MCW   @1@,CF        * SET NEXT TO ADD                          7  0363  M R5V 154            9
  152                MCW   C25,DIVBAS              * SET NEXT TO ADD                7  0370  M 141 111           10
  153                B     ATAN          *** CALL ATAN SUBROUTINE                   4  0377  B 428               10
1                               SUBROUTINE  PI                                                            PAGE    3
0 SEQ PG LIN  LABEL  OP    OPERANDS                                            SFX CT  LOCN  INSTRUCTION TYPE  CARD
 
  154         *
  155         * NOW, ADD MINUS 4*ARCTAN(1/239) TO ABOVE  16*ARCTAN(1/5)
  156         * DO NOT ZERO ACCUMULATOR
  157         START2 MCW   @0@,BASET&2048  * ZERO BASE                              7  0381  M R5S Q49           10
  158                MCW   BASET&2048,BASET&2047                                    7  0388  M Q49 Q48           10
  159                MCW   @956@,BASET&8   * SET A HIGH ORDER TO 1*4*239            7  0395  M R5Y 809           10
  160                MCW   @0@,CF          * SET NEXT SUBTRACT                      7  0402  M R5S 154           10
  161                MCW   C239P2,DIVBAS   * SET SET BASE DIVISOR                   7  0409  M 147 111           11
  162                B     ATAN            *** CALL ATAN SUBROUTINE                 4  0416  B 428               11
  163         * WE NOW HAVE PI IN MEMORY, PRINT IT OUT
  164                B     PRINT           * CALL PRINT ROUTINE                     4  0420  B 626               11
  165         HALT   H     START           *** HALT HERE -                          4  0424  . 164               11
  166         *
  167         ATAN   SBR   ATANX&3         * SET RETURN                             4  0428  H 625               11
  168                MCW   C0,CNTZRO       * CLEAR LEADING ZERO COUNTER             7  0432  M 123 153           11
  169                MCW   C0,ITCNT        * ZERO ITERATION CNTR                    7  0439  M 123 105           11
  170                MCW   C1,IX2P1        * INIT INTER DIVISOR                     7  0446  M 129 117           12
  171                MCW   @000@,X1        * CLEAR ASSOCIATED INDEX REGISTER        7  0453  M R6/ 089           12
  172         ATANL  MCW   @+@,BASET&2049  * SET POSITIVE SIGN                      7  0460  M R5/ Q50           12
  173                D     DIVBAS,BASET&6     * TRIAL ARITH                         7  0467  % 111 807           12
  174                MCW   BASET&2042,BASET&2049  * SHIFT QUOTIENT                  7  0474  M Q43 Q50           12
  175                MCW   LC0L9,BASET&6      * REMOVE UNSHIFTED                    7  0481  M 163 807           13
  176                MCW   BASET&2049,INTER&2049  * MOVE QUOTIENT TO NEXT           7  0488  M Q50 90'           13
  177                MCW   @+@,INTER&2049     * SET POSITIVE SIGN                   7  0495  M R5/ 90'           13
  178                D     IX2P1,INTER&6    DIVIDE INTERMEDIATE                     7  0502  % 117 Q57           13
  179                MCW   INTER&2042,INTER&2049   * SHIFT INTERMEDIATE             7  0509  M 89T 90'           13
  180                MCW   LC0L9,INTER&6        * REMOVE UNSHIFTED                  7  0516  M 163 Q57           14
  181                MCW   @+@,INTER&2049  * SET UP BASE                            7  0523  M R5/ 90'           14
  182                BCE   ATANA,CF,1        * COMPARE FOR ADD                      8  0530  B 556 154 1         14
  183         ATANS  MCW   @1@,CF              * SET NEXT ADD                       7  0538  M R5V 154           14
  184                S     INTER&2049,ACCUM&2049   * DO THE SUBTRACTION             7  0545  S 90' R5'           14
  185                B     ATANW                * GO TO WRAP-UP                     4  0552  B 570               15
  186         ATANA  A     INTER&2049,ACCUM&2049   * ADD TO ACCUMULATOR             7  0556  A 90' R5'           15
  187                MCW   @0@,CF              * SET NEXT SUBTRACT                  7  0563  M R5S 154           15
  188         ATANW  A     C1,ITCNT            * INC ITERATION COUNT                7  0570  A 129 105           15
  189                A     C2,IX2P1            * FORM NEXT DIVISOR                  7  0577  A 135 117           15
  190         ATANB  BCE   ATANI,BASET&X1,0   * CHAR = 0, DONE?                     8  0584  B 596 8'1 0         16
  191                B     ATANL                * GO DO ANOTHER LOOP PASS           4  0592  B 460               16
  192         ATANI  A     C1,CNTZRO           * INCREMENT # LEADING ZEROS          7  0596  A 129 153           16
  193                SBR   X1,1&X1             * INCREMENT X1                       7  0603  H 089 0'1           16
  194                C     CNTZRO,@2049@         * CHECK END                        7  0610  C 153 R6V           16
  195                BU    ATANB              * NO, CHECK MORE ZEROS                5  0617  B 584 /             16
  196         ATANX  B     0                  *** RETURN TO CALL                    4  0622  B 000               17
  197         *
  198         *
  199         * -------------------------------------------------------------
  200         *
  201         *  NOW WE PRINT THAT BABY OUT :-))
  202         * PROPOSED FORMAT
  203         * 2
1                               SUBROUTINE  PI                                                            PAGE    4
0 SEQ PG LIN  LABEL  OP    OPERANDS                                            SFX CT  LOCN  INSTRUCTION TYPE  CARD
 
  204         * 0        1         2         3         4         5         6         7
  205         * 1234567890123456789012345678901234567890123456789012345678901234567890123
  206         *                                                        3. * 10E-00000
  207         * + NNNNNNNNNN NNNNNNNNNN NNNNNNNNNN NNNNNNNNNN NNNNNNNNNN  * 10E-00050
  208         * + NNNNNNNNNN NNNNNNNNNN NNNNNNNNNN NNNNNNNNNN NNNNNNNNNN  * 10E-00100
  209         PRINT  SBR   PRINTX&3                                                 4  0626  H 800               17
  210         PRINTD MCW   @008@,X1   * CLEAR PICKUP X                              7  0630  M R6Y 089           17
  211                MCW   C0,ITCNT   * CLEAR TOTAL CH MOVED                        7  0637  M 123 105           17
  212                CS    332    * START CLEARING DOWN TO 200, PRINT AREA          4  0644  / 332               17
  213                CS                                                             1  0648  /                   17
  214                MCW   @. * 10E-00000@,269                                      7  0649  M R8/ 269           17
  215                SW    265                    * SET WORD MARK IN EXPONENT F     4  0656  , 265               18
  216                MCW   ACCUM&X1,256  MOVE 5TH FIELD                             7  0660  M 9'/ 256           18
  217                SBR   X1,10&X1     * STEP X1                                   7  0667  H 089 0/0           18
  218                W            *WRITE THE PRINT AREA TO THE PRINTER              1  0674  2                   18
  219         *
  220         PR1LOP CS    252        * CLEAR PREVIOUS NUMERICS                     4  0675  / 252               18
  221                SW    203,214    * SET WORD MARKS FOR B FIELD                  7  0679  , 203 214           18
  222                SW    225,236                                                  7  0686  , 225 236           18
  223                SW    247,265                                                  7  0693  , 247 265           19
  224                A     @00050@,269 * ADD 50 TO EXPONENT                         7  0700  A R8W 269           19
  225                MCW   ACCUM&X1,212  MOVE 1ST FIELD                             7  0707  M 9'/ 212           19
  226                SBR   X1,10&X1     * STEP X1                                   7  0714  H 089 0/0           19
  227                MCW   ACCUM&X1,223  MOVE 2ND FIELD                             7  0721  M 9'/ 223           19
  228                SBR   X1,10&X1     * STEP X1                                   7  0728  H 089 0/0           20
  229                MCW   ACCUM&X1,234  MOVE 3RD FIELD                             7  0735  M 9'/ 234           20
  230                SBR   X1,10&X1     * STEP X1                                   7  0742  H 089 0/0           20
  231                MCW   ACCUM&X1,245  MOVE 4TH FIELD                             7  0749  M 9'/ 245           20
  232                SBR   X1,10&X1     * STEP X1                                   7  0756  H 089 0/0           20
  233                MCW   ACCUM&X1,256  MOVE 5TH FIELD                             7  0763  M 9'/ 256           21
  234                SBR   X1,10&X1     * STEP X1                                   7  0770  H 089 0/0           21
  235                W            *WRITE THE PRINT AREA TO THE PRINTER              1  0777  2                   21
  236                A     @000050@,ITCNT   * ADD 50 TO TOTAL DIGITS                7  0778  A R9S 105           21
  237                C     @002000@,ITCNT   * TEST FOR END                          7  0785  C R9Y 105           21
  238                BL    PR1LOP         * END IS HIGHER THAN COUNT                5  0792  B 675 T             21
  239         PRINTX B     0              *** RETURN TO CALL                        4  0797  B 000               21
  240         *
  241         *
  242         *  LARGE AREAS RON MAK SAYS THAT BLANKS PROCESS AS ZEROS
  243         *          ORG  780
  244         *FLDLEN    EQU  2050      * LENGTH OF THE 3 BIG FIELDS
  245         BASET  DA    1X2050,C  * BASE, 1ST DIVISION HERE                         0801   2850
  246         INTER  DA    1X2050,C  * INTERMEDIATE BUFFER, 2ND DIVISION HERE          2851   4900
  247         ACCUM  DA    1X2050,C  * ACCUMULATOR, ANSWER IS FORMED HERE              4901   6950
  248         *   1         2         3         4         5         6         7         8
  249         *78901234567890123456789012345678901234567890123456789012345678901234567890
  250         * LABEL   | OP | OPERATION                                         |XXXXXXX
  251         *
  252         *** NOV 15
  253         * MACHIN'S METHOD -
1                               SUBROUTINE  PI                                                            PAGE    5
0 SEQ PG LIN  LABEL  OP    OPERANDS                                            SFX CT  LOCN  INSTRUCTION TYPE  CARD
 
  254         * PI = 16ARCTAN(1/5) - 4ARCTAN(1/239)
  255         * AN ARCTAN SERIES IS 1/N - 1/(3XN^3) + 1/(5XN^5) - ...
  256         *
  257         *** NOV 16
  258         * IN ANY CASE,
  259         *LETS DO ARCTAN(X),  X = 1/5
  260         *   0.19739555984988075837004976519479
  261         *THEN  16ARCTAN(1/5)
  262         *   3.1583289575980921339207962431166
  263         * THEN ARCTAN(1/239)
  264         *   0.0041840760020747238645382149592855
  265         * TIMES 4
  266         *   0.016736304008298895458152859837142
  267         * PI =
  268         *    3.1415926535897932384626433832795
  269         * :-))
  270         *
  271         * SET N TO 1/X = 5      (THIS IS THE FANCY FOOTWORK :-))
  272         *
  273         * 1) A) FORM THREE LARGE AS PRACTICAL EQUAL SIZED AREAS IN MEMORY.
  274         *       LETS CALL THEM "ACCUMULATOR",       ACCUM
  275         *                      "INTERMEDIATE",      INTER
  276         *                      "BASE OF NEXT TERM"  BASET
  277         *     B) FORM SMALLER WORKING AREAS
  278         *          ITERATION COUNTER ITCNT    USED FOR OBSERVATION
  279         *                  STARTS AT ZERO, COUNTS UP AFTER A PASS
  280         *          DIVISOR OF BASET, DIVBAS,   USUALLY 5^2 OR 239^2
  281         *                  5^2 = 25,   239^2 = 57121
  282         *          ADD/SUBTRACT CONTROL FLAG, CF , TOGGLED AFTER A PASS
  283         *                0 MEANS ADD, OTHER IS SUBTRACT
  284         *          DIVISOR OF INTER IS IX2P1 , ITCNT TIMES 2 PLUS 1
  285         *
  286         * 2) FIGURE WHERE THE DECIMAL POINT WILL BE
  287         *     (SAME RELATIVE PLACE IN EACH AREA)
  288         *     ( SEVERAL CHARACTERS OR WORDS TO THE "RIGHT" OF
  289         *       THE TOP SIGNIFICANCE.)
  290         *
  291         * 3) A) ZERO THE  ACCUM
  292         *     B) ( INTER DOES NOT NEED INITIALIZATION)
  293         *    C) SET X (5.0 IN OUR EXAMPLE) INTO BASET
  294         *    D) SET COUNTER N TO 1
  295         *
  296         * 4) WHILE BASET IS NON-ZERO
  297         *    A) DIVIDE BASET BY X^2  ( 25 IN OUR EXAMPLE ) GIVING BASET
  298         *    B) DIVIDE BASET BY (2XN - 1) GIVING INTER
  299         *    C) IF N IS ODD, ADD INTERMEDIATE TO ACCUMULATOR
  300         *           ELSE, SUBTRACT INTERMEDIATE FROM ACCUMULATOR
  301         *    D) ADD 1 TO N (ASSURE THAT MACHINE CAN DIVIDE BY 2N)
  302         *
  303         * 5) ACCUMULATOR IS A FINE APPROXIMATION OF ARCTAN(X)   ;-))
1                               SUBROUTINE  PI                                                            PAGE    6
0 SEQ PG LIN  LABEL  OP    OPERANDS                                            SFX CT  LOCN  INSTRUCTION TYPE  CARD
 
                     DCW   @+@                                                      1  6951              LIT    180
                     DCW   @0@                                                      1  6952              LIT    180
                     DCW   @80@                                                     2  6954              LIT    180
                     DCW   @1@                                                      1  6955              LIT    181
                     DCW   @956@                                                    3  6958              LIT    181
                     DCW   @000@                                                    3  6961              LIT    181
                     DCW   @2049@                                                   4  6965              LIT    181
                     DCW   @008@                                                    3  6968              LIT    181
                     DCW   @. * 10E-00000@                                         13  6981              LIT    181
                     DCW   @00050@                                                  5  6986              LIT    181
                     DCW   @000050@                                                 6  6992              LIT    182
                     DCW   @002000@                                                 6  6998              LIT    182
  304                END   START  * LAST CARD IN DECK, TRANSFER ADDRESS                      / 164 080
1                               SUBROUTINE  PI                                                            PAGE    7
0SYMBOL  ADDRESS  SYMBOL  ADDRESS  SYMBOL  ADDRESS  SYMBOL  ADDRESS  SYMBOL  ADDRESS  SYMBOL  ADDRESS  SYMBOL  ADDRESS  

 ACCUM    4901    ATAN      428    ATANA     556    ATANB     584    ATANI     596    ATANL     460    ATANS     538   
 ATANW     570    ATANX     622    BASET     801    C0        123    C1        129    C2        135    C239P2    147   
 C25       141    CF        154    CNTZRO    153    DIVBAS    111    HALT      424    INTER    2851    ITCNT     105   
 IX2P1     117    LC0L9     163    PR1LOP    675    PRINT     626    PRINTD    630    PRINTX    797    START     164   
 START1    335    START2    381    X1         89    X2         94    X3         99