let of_probability_exn ?(f = round_float_to_int) x =
  match of_probability ~f x with
  | Some s -> s
  | None ->
    Error (sprintf "invalid probability %0.17g" x) |! raise