Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.Sign up
GitHub is where the world builds software
Millions of developers and companies build, ship, and maintain their software on GitHub — the largest and most advanced development platform in the world.
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.