begin
reals long
integer rounds
real pi = 1.0
!%on %event 9 %start
! print string("Cannot open file"); newline
! %stop
!%finish
integer i
open input(1, "rounds.txt"); ! open file
select input(1)
read(rounds)
close input; ! close file
rounds = rounds + 2; ! do this outside the loop
for i=2, 1, rounds cycle
long real x = -1.0 + 2.0 * (i & 1); ! allows vectorization
pi = pi + (x / (2 * i - 1)); ! double / unsigned = double
repeat
pi = pi * 4
print fl(pi, 16); ! print 16 decimal digits of pi
newline
endofprogram