Join GitHub today
GitHub is home to over 36 million developers working together to host and review code, manage projects, and build software together.Sign up
Documentation for Printf's format "%g" looks imprecise or incorrect #7507
Original bug ID: 7507
In stdlib/printf.mli, the documentation for the %g format states:
This seems to indicate that the documentation for %g is quite vague, at best.
Comment author: @gasche
I have bad news for you: OCaml does not implement %g itself, it delegates to the libc's %g format semantics (see: "man 3 printf"). This means that you will get inconsistent results across platforms and that giving a precise and correct specification is unlikely to succeed.
Comment author: @xavierleroy
Quoting from the glibc man pages:
So, the summary in the OCaml documentation is not too bad. If we really want, we could add a sentence about trailing zeros possibly removed.