9
1
mirror of https://github.com/QuantumPackage/qp2.git synced 2024-11-12 00:13:39 +01:00
qp2/ocaml/Charge.ml

18 lines
282 B
OCaml
Raw Normal View History

2019-01-25 11:39:31 +01:00
open Core
type t = float [@@deriving sexp]
let of_float x = x
let of_int i = Float.of_int i
let of_string s = Float.of_string s
let to_float x = x
let to_int x = Float.to_int x
let to_string x =
if x >= 0. then
Printf.sprintf "+%f" x
else
Printf.sprintf "%f" x