9
1
mirror of https://github.com/QuantumPackage/qp2.git synced 2024-12-23 03:53:29 +01:00
qp2/ocaml/Charge.ml

18 lines
293 B
OCaml
Raw Normal View History

2019-03-13 13:02:29 +01:00
open Sexplib.Std
2019-01-25 11:39:31 +01:00
type t = float [@@deriving sexp]
2019-03-13 13:02:29 +01:00
let of_float x = x
let of_int i = float_of_int i
let of_string s = float_of_string s
2019-01-25 11:39:31 +01:00
2019-03-13 13:02:29 +01:00
let to_float x = x
let to_int x = int_of_float x
2019-01-25 11:39:31 +01:00
let to_string x =
if x >= 0. then
Printf.sprintf "+%f" x
else
Printf.sprintf "%f" x