Skip to content

Commit 1e5114c

Browse files
authored
CA-404591 - rrd: Do not lose precision when converting floats to strings (xapi-project#6238)
`lastupdate` field in the XML RRD blob file, in particular, was getting truncated floats representing the number of seconds, which loses A LOT of precision, meaning RRDs could not be checked to have been produced with the 5-second frequency.
2 parents 43d01ca + 731ede7 commit 1e5114c

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

ocaml/libs/xapi-rrd/lib/rrd_utils.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ let array_remove n a =
6969
let f_to_s f =
7070
match classify_float f with
7171
| FP_normal | FP_subnormal ->
72-
Printf.sprintf "%0.5g" f
72+
Printf.sprintf "%0.15g" f
7373
| FP_nan ->
7474
"NaN"
7575
| FP_infinite ->

0 commit comments

Comments
 (0)