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: documentation unclear regarding %g precision formatting #15178
Current go 1.5 documentation is not clear regarding the %g formatting. In particular, it states
This seems to imply that width for %g/%G is the total number of digits that will be outputted, while it is the number of significant digits, therefore leading zeroes does not contribute to the count. For example, formatting 0.001234 with %.3g will be printed without changes, 0.001234, while from the docs it seems that only 0.001 should be printed.
I propose to change the documentation and change the following:
with the following (bold used to mark the changes)
Or with a better statement and/or example if the one I provided are not accurate enough.