Files
rose-ash/lib/ocaml/baseline/expected.json
giles 50981a2a9b
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 43s
ocaml: phase 5.1 bisect.ml baseline (root-finding, sqrt(2)*100 = 141)
Bisection method searching for f(x) = 0 in [lo, hi] over 50
iterations:

  let bisect f lo hi =
    let lo = ref lo and hi = ref hi in
    for _ = 1 to 50 do
      let mid = (!lo +. !hi) /. 2.0 in
      if f mid = 0.0 || f !lo *. f mid < 0.0 then hi := mid
      else lo := mid
    done;
    !lo

Solving x^2 - 2 = 0 in [1, 2] via 'bisect (fun x -> x *. x -. 2.0)
1.0 2.0' converges to ~1.41421356... -> int_of_float (r *. 100) =
141.

Tests:
  - higher-order function passing
  - multi-let 'let lo = ref ... and hi = ref ...'
  - float arithmetic
  - int_of_float truncate-toward-zero (iter 117)

62 baseline programs total.
2026-05-09 13:02:17 +00:00

67 lines
1.3 KiB
JSON

{
"ackermann.ml": 125,
"anagram_check.ml": 2,
"anagrams.ml": 3,
"atm.ml": 120,
"bag.ml": 3,
"bf_full.ml": 6,
"bisect.ml": 141,
"bigint_add.ml": 28,
"bits.ml": 21,
"balance.ml": 3,
"base_n.ml": 17,
"bfs.ml": 6,
"btree.ml": 39,
"brainfuck.ml": 75,
"bsearch.ml": 7,
"caesar.ml": 215,
"calc.ml": 13,
"closures.ml": 315,
"coin_change.ml": 6,
"csv.ml": 10,
"exception_handle.ml": 4,
"exception_user.ml": 26,
"expr_eval.ml": 16,
"expr_simp.ml": 22,
"factorial.ml": 3628800,
"fraction.ml": 7,
"frequency.ml": 5,
"gcd_lcm.ml": 60,
"grep_count.ml": 3,
"hanoi.ml": 1023,
"fizzbuzz.ml": 57,
"flatten_tree.ml": 28,
"list_ops.ml": 30,
"mat_mul.ml": 621,
"json_pretty.ml": 24,
"kadane.ml": 6,
"lambda_calc.ml": 7,
"levenshtein.ml": 11,
"memo_fib.ml": 75025,
"merge_sort.ml": 44,
"module_use.ml": 3,
"newton_sqrt.ml": 1414,
"mutable_record.ml": 10,
"option_match.ml": 5,
"palindrome.ml": 4,
"pascal.ml": 252,
"pi_leibniz.ml": 314,
"pretty_table.ml": 64,
"poly_stack.ml": 5,
"prime_factors.ml": 17,
"queens.ml": 2,
"quicksort.ml": 44,
"roman.ml": 44,
"rpn.ml": 9,
"run_length.ml": 11,
"safe_div.ml": 20,
"shuffle.ml": 55,
"word_freq.ml": 8,
"zip_unzip.ml": 1000,
"sieve.ml": 15,
"sum_squares.ml": 385,
"unique_set.ml": 9,
"validate.ml": 417,
"word_count.ml": 3
}