10
1
mirror of https://gitlab.com/scemama/QCaml.git synced 2024-11-07 06:33:39 +01:00
QCaml/Utils/Positive_float.ml

15 lines
227 B
OCaml
Raw Normal View History

2018-01-02 22:33:17 +01:00
type t = float
2018-01-02 22:02:01 +01:00
let of_float x =
assert ( x >= 0. );
x
2018-02-13 13:55:16 +01:00
external to_float : t -> float = "%identity"
2018-01-02 22:02:01 +01:00
2018-02-13 13:55:16 +01:00
let to_string x =
let f = to_float x in string_of_float f
2018-01-02 22:02:01 +01:00
2018-02-13 13:55:16 +01:00
let of_string x =
let f = float_of_string x in of_float f
2018-01-02 22:02:01 +01:00