2 COMMENT -- WINTER-PI
2
2 PROGRAM TO COMPUTE PI TO 800 DIGITS. CONVERTED TO BURROUGHS 220
2 BALGOL FROM THE ONE-LINE C PROGRAM WRITTEN BY DIK T. WINTER AT CWI,
2 AS REPORTED IN
2 HTTPS://CS.UWATERLOO.CA/~ALOPEZ-O/MATH-FAQ/MATHTEXT/NODE12.HTML
2
2 THE PROGRAM OUTPUTS FOUR DECIMAL DIGITS AT A TIME TO THE SPO.
2 IT CONVERTS EACH FOUR-DIGIT RESULT TO FOUR 1-DIGIT NUMBERS,
2 OUTPUTTING AS BALGOL I-FORMAT, THUS ENSURING ANY LEADING ZERO
2 DIGITS ARE FORMATTED AS ZEROES AND NOT AS SPACES.
2
2 2016-01-13  P.KIMPEL
2     ORIGINAL VERSION, FOR UNISYS MCP EXTENDED ALGOL.
2 2016-01-16  P.KIMPEL
2     ADAPTED FROM UNISYS MCP ALGOL TO B5500 EXTENDED ALGOL.
2 2018-08-09  P.KIMPEL
2     ADAPTED FROM B5500 EXTENDED ALGOL TO BURROUGHS 220 BALGOL.
2 ;
2
2 INTEGER
2   A,
2   B,
2   BUF,
2   C,
2   D,
2   E,
2   F,
2   G,
2   I,
2   J;
2 ARRAY
2   F(2801),
2   BUF(20);
2 FORMAT
2   F1 (20(4I1,B1), W2);
2 OUTPUT
2   L1 (FOR J = (1, 1, I-1);
2         (MOD(BUF(J)/1000, 10), MOD(BUF(J)/100, 10),
2         MOD(BUF(J)/10, 10), MOD(BUF(J), 10)));
2
2 A = 10000;
2 C = 2800;
2 I = 1;
2
2 FOR B = (1, 1, C+1);
2   F(B) = A/5;
2
2 UNTIL C EQL 0;
2   BEGIN
2   G = 2C;
2   D = 0;
2
2   B = C;
2   UNTIL B EQL 0;
2     BEGIN
2     D = D+F(B+1).A;
2     G = G-1;
2     F(B+1) = MOD(D, G);
2     D = D/G;
2     G = G-1;
2     B = B-1;
2     IF (B NEQ 0);
2       D = D.B
2     END;
2
2   C = C-14;
2   IF I GTR 20;
2     BEGIN
2     WRITE (;; L1, F1);
2     I = 1
2     END;
2
2   BUF(I) = E + D/A;
2   I = I+1;
2   E = MOD(D, A)
2   END;
2
2 WRITE (;; L1, F1);
2 FINISH;
