Files
rose-ash/lib/ocaml/baseline/expected.json
giles 90418c120b
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 24s
ocaml: phase 5.1 pi_leibniz.ml baseline + int_of_float fix (1000 terms x 100 = 314)
pi_leibniz.ml: Leibniz formula for pi.

  pi/4 = 1 - 1/3 + 1/5 - 1/7 + ...
  pi  ~= 4 * sum_{k=0}^{n-1} (-1)^k / (2k+1)

For n=1000, pi ~= 3.140593. Multiply by 100 and int_of_float -> 314.

Side-quest: int_of_float was wrongly defined as identity in
iteration 94. Fixed to:

  let int_of_float f =
    if f < 0.0 then _float_ceil f else _float_floor f

(truncate toward zero, mirroring real OCaml's int_of_float). The
identity definition was a stub from when integer/float dispatch was
not yet split — now they're separate, the stub is wrong.

Float.to_int still uses floor since OCaml's docs say the result is
unspecified for nan / out-of-range; close enough for our scope.

32 baseline programs total.
2026-05-09 07:19:52 +00:00

37 lines
726 B
JSON

{
"anagrams.ml": 3,
"bag.ml": 3,
"balance.ml": 3,
"bfs.ml": 6,
"btree.ml": 39,
"brainfuck.ml": 75,
"caesar.ml": 215,
"calc.ml": 13,
"closures.ml": 315,
"csv.ml": 10,
"exception_handle.ml": 4,
"expr_eval.ml": 16,
"factorial.ml": 3628800,
"fraction.ml": 7,
"frequency.ml": 5,
"fizzbuzz.ml": 57,
"list_ops.ml": 30,
"lambda_calc.ml": 7,
"levenshtein.ml": 11,
"memo_fib.ml": 75025,
"merge_sort.ml": 44,
"module_use.ml": 3,
"mutable_record.ml": 10,
"option_match.ml": 5,
"pi_leibniz.ml": 314,
"poly_stack.ml": 5,
"queens.ml": 2,
"quicksort.ml": 44,
"roman.ml": 44,
"safe_div.ml": 20,
"sieve.ml": 15,
"sum_squares.ml": 385,
"unique_set.ml": 9,
"word_count.ml": 3
}