Skip to content

"%g" formatter for floats looses a lot of precision on some use cases #25

@smondet

Description

@smondet

Here:
https://github.com/OCamlPro/ocplib-json-typed/blob/master/src/json_repr.ml#L161

(* Example: Half-an-hour on time-stamps :) *)
ocaml# Format.fprintf Format.std_formatter "%g\n%!" (Unix.gettimeofday ());;
1.54543e+09
ocaml# (Unix.gettimeofday () -. 1.54543e+09) /. 60.;;
- : float = 30.1761083324750281

pp is used there:

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions