
Create a program to continually calculate and output the next decimal digit of   



π


{\displaystyle \pi }

   (pi).

The program should continue forever (until it is aborted by the user) calculating and outputting each decimal digit in succession.

The output should be a decimal sequence beginning   3.14159265 ...



Note: this task is about   calculating   pi.   For information on built-in pi constants see Real constants and functions.



Related Task Arithmetic-geometric mean/Calculate Pi

      WIDTH 80
      M% = (HIMEM-END-1000) / 4
      DIM B%(M%)
      FOR I% = 0 TO M% : B%(I%) = 20 : NEXT
      E% = 0
      L% = 2
      FOR C% = M% TO 14 STEP -7
        D% = 0
        A% = C%*2-1
        FOR P% = C% TO 1 STEP -1
          D% = D%*P% + B%(P%)*&64
          B%(P%) = D% MOD A%
          D% DIV= A%
          A% -= 2
        NEXT
        CASE TRUE OF
          WHEN D% = 99: E% = E% * 100 + D% : L% += 2
          WHEN C% = M%: PRINT ;(D% DIV 100) / 10; : E% = D% MOD 100
          OTHERWISE:
            PRINT RIGHT$(STRING$(L%,"0") + STR$(E% + D% DIV 100),L%);
            E% = D% MOD 100 : L% = 2
        ENDCASE
      NEXT