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.
fmt: unexpected trailing period with alternate floating point formats #37744
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:
The alternate format for
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.
Working as intended.