mirror of
https://github.com/QuantumPackage/qp2.git
synced 2024-12-26 21:33:30 +01:00
18 lines
293 B
OCaml
18 lines
293 B
OCaml
open Sexplib.Std
|
|
|
|
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 = int_of_float x
|
|
let to_string x =
|
|
if x >= 0. then
|
|
Printf.sprintf "+%f" x
|
|
else
|
|
Printf.sprintf "%f" x
|
|
|