Float.round: float -> float rounds a float to the nearest integer. I’m looking for a rounding function that lets me round to a given number of decimals. My first idea would be something like:
let round2 n = Float.(n *. 100.0 |> round |> fun x -> x /. 100.0);; # round2 Float.pi;; - : float = 3.14
Any better idea?