-
Notifications
You must be signed in to change notification settings - Fork 17.9k
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
fmt: %#g behavior not consistent #36562
Comments
This seems consistent with the documentation (https://godoc.org/fmt) of the "For floating-point values, width sets the minimum width of the field and precision sets the number of places after the decimal, if appropriate, except that for %g/%G precision sets the maximum number of significant digits (trailing zeros are removed)." |
I see now that "do not remove trailing zeros for %g and %G;" So you are right this should have trailing zeros. |
Change https://golang.org/cl/215001 mentions this issue: |
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes.
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
https://play.golang.org/p/uhRa_BD_pUX
What did you expect to see?
%#.4g
should print 4 significant digits, without removing trailing zeros.What did you see instead?
The trailing zero from
1.230
is erroneously removed.The text was updated successfully, but these errors were encountered: