|
procedure main()
|
|
every t := 10 ^ ( 5 to 9 ) do
|
|
printf("Rounds=%d Pi ~ %r\n",t,getPi(t))
|
|
end
|
|
|
|
link printf
|
|
|
|
procedure getPi(rounds)
|
|
incircle := 0.
|
|
every 1 to rounds do
|
|
if 1 > sqrt((?0 * 2 - 1) ^ 2 + (?0 * 2 - 1) ^ 2) then
|
|
incircle +:= 1
|
|
return 4 * incircle / rounds
|
|
end
|