From f96fbe7d3194ac324eca37ccc7139749c4d5bb33 Mon Sep 17 00:00:00 2001 From: OCamlPro-Iguernlala Date: Wed, 29 Mar 2017 18:02:19 +0200 Subject: [PATCH] [bugfix in data_encoding] When reading a float (from binary format), MBytes.get_double should be used instead of MBytes.get_float (Float _ encodes doubles in the encoding, not singles) --- src/minutils/data_encoding.ml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/minutils/data_encoding.ml b/src/minutils/data_encoding.ml index 17cb3f981..fc7e5d71b 100644 --- a/src/minutils/data_encoding.ml +++ b/src/minutils/data_encoding.ml @@ -1033,8 +1033,10 @@ let rec length : type x. x t -> x -> int = fun e -> let int64 buf ofs _len = ofs + Size.int64, MBytes.get_int64 buf ofs + (** read a float64 (double) **) let float buf ofs _len = - ofs + Size.float, MBytes.get_float buf ofs + (* Here, float means float64, which is read using MBytes.get_double !! *) + ofs + Size.float, MBytes.get_double buf ofs let int_of_int32 i = let i' = Int32.to_int i in