10
0
mirror of https://github.com/LCPQ/quantum_package synced 2024-11-05 05:33:56 +01:00
quantum_package/ocaml/Charge.ml

18 lines
283 B
OCaml
Raw Normal View History

2017-08-18 18:28:33 +02:00
open Core
2014-10-07 19:33:11 +02:00
2017-08-18 18:28:33 +02:00
type t = float [@@deriving sexp]
2014-10-07 19:33:11 +02:00
let of_float x = x
let of_int i = Float.of_int i
let of_string s = Float.of_string s
2014-10-25 21:24:21 +02:00
2014-10-07 19:33:11 +02:00
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