RosettaCodeData/Task/Pi/OCaml/pi-1.ocaml

13 lines
236 B
Text
Raw Permalink Normal View History

2013-04-10 22:43:41 -07:00
open Creal;;
let block = 100 in
let segment n =
let s = to_string pi (n*block) in
String.sub s ((n-1)*block) block in
let counter = ref 1 in
while true do
print_string (segment !counter);
flush stdout;
incr counter
done