Skip to content

Commit

Permalink
CA-404591 - rrd: Do not lose precision when converting floats to strings
Browse files Browse the repository at this point in the history
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.

Signed-off-by: Andrii Sultanov <andrii.sultanov@cloud.com>
  • Loading branch information
last-genius committed Jan 17, 2025
1 parent 43d01ca commit 731ede7
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion ocaml/libs/xapi-rrd/lib/rrd_utils.ml
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ let array_remove n a =
let f_to_s f =
match classify_float f with
| FP_normal | FP_subnormal ->
Printf.sprintf "%0.5g" f
Printf.sprintf "%0.15g" f
| FP_nan ->
"NaN"
| FP_infinite ->
Expand Down

0 comments on commit 731ede7

Please sign in to comment.