New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Documentation for Printf's format "%g" looks imprecise or incorrect #7507
Comments
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: @Armael Could the documentation refer to the libc's semantics, then? |
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. |
Comment author: @Octachron Reading the OCaml documentation, I would think that the most surprising part is the elision of the decimal point which does happen for neither %f, %e or %E. Should I document this point? |
Comment author: @gasche Follow your heart. |
Comment author: @Octachron The corresponding github PR, directly inspired from the C90 standard description, is here #1163 . Armael, do you wish to be cited in the changelog? |
Comment author: @Armael No, don't bother. Thanks for taking care of this! |
Original bug ID: 7507
Reporter: @Armael
Assigned to: @Octachron
Status: resolved (set by @Octachron on 2017-05-08T21:18:54Z)
Resolution: fixed
Priority: normal
Severity: minor
Fixed in version: 4.06.0 +dev/beta1/beta2/rc1
Category: documentation
Bug description
In stdlib/printf.mli, the documentation for the %g format states:
However:
This seems to indicate that the documentation for %g is quite vague, at best.
The text was updated successfully, but these errors were encountered: