Commit e774556b authored by Sylvain Dailler's avatar Sylvain Dailler
Browse files

JSON communication: Adding a way to print %f float numbers

parent c61edffe
...@@ -33,8 +33,8 @@ let string fmt s = ...@@ -33,8 +33,8 @@ let string fmt s =
let int fmt d = fprintf fmt "%d" d let int fmt d = fprintf fmt "%d" d
let bool fmt b = fprintf fmt "%b" b let bool fmt b = fprintf fmt "%b" b
let standard_float fmt f = fprintf fmt "%f" f
let float fmt f = fprintf fmt "%g" f let float fmt f = fprintf fmt "%g" f
(* TODO check that you can print a floating point number like this in JSON *)
let print_json_field key value_pr fmt value = let print_json_field key value_pr fmt value =
fprintf fmt "%a : %a " string key value_pr value fprintf fmt "%a : %a " string key value_pr value
......
...@@ -19,7 +19,11 @@ val int : Format.formatter -> int -> unit ...@@ -19,7 +19,11 @@ val int : Format.formatter -> int -> unit
val bool : Format.formatter -> bool -> unit val bool : Format.formatter -> bool -> unit
(* print an boolean *) (* print an boolean *)
val float : Format.formatter -> float -> unit val float : Format.formatter -> float -> unit
(* print an floating point number *) (* print a floating point number *)
val standard_float : Format.formatter -> float -> unit
(* print a float in a format that cannot be mistaken for an integer (this makes
communication with other tools easier).
*)
val list : val list :
(Format.formatter -> 'a -> unit) -> Format.formatter -> 'a list -> unit (Format.formatter -> 'a -> unit) -> Format.formatter -> 'a list -> unit
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment