You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Using the alternate floating point formats adds an unexpected trailing period when the fractional part falls just outside the significant figures (playground link):
As the document added in that commit says, the definition of this format is to always include the decimal point. That's what it's for. Compare with https://play.golang.org/p/lS5Z2QkCDFp, which shows how to get what you want: don't ask for the alternate format.
Moreover, in this respect I believe the behavior is completely compatible with C, which also adds a decimal point in the alternate format.
go version go1.14 linux/amd64
Using the alternate floating point formats adds an unexpected trailing period when the fractional part falls just outside the significant figures (playground link):
What did you expect to see?
What did you see instead?
This is awkward when displaying values for consumption by people. Eg:
fmt.Printf("%#.3gm", 123.0)
gives123.m
instead of the expected123m
.The alternate format for
%f
and%g
was added in e97f407.C
printf
behaves as expected and does not print trailing periods.Cc @robpike @martisch
The text was updated successfully, but these errors were encountered: