10
1
mirror of https://gitlab.com/scemama/QCaml.git synced 2024-09-06 11:44:48 +02:00
QCaml/Utils/NonNegativeFloat.ml
2018-02-24 23:57:38 +01:00

16 lines
279 B
OCaml

type t = float
let of_float x =
assert ( x >= 0. );
x
external to_float : t -> float = "%identity"
external unsafe_of_float : float -> t = "%identity"
let to_string x =
let f = to_float x in string_of_float f
let of_string x =
let f = float_of_string x in of_float f