
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

let prec = precision(BigFloat), spi = "", digit = 1
    while true
      if digit > lastindex(spi)
        prec *= 2
        setprecision(prec)
        spi = string(big(π))
      end
      print(spi[digit])
      digit += 1
    end
end