]> Cypherpunks repositories - gostls13.git/commitdiff
fmt: clarify that for %g precision determines number of significant digits
authorRob Pike <r@golang.org>
Wed, 13 Apr 2016 18:47:25 +0000 (11:47 -0700)
committerRob Pike <r@golang.org>
Thu, 14 Apr 2016 00:13:10 +0000 (00:13 +0000)
Documentation change only.

Fixes #15178.

Change-Id: I3c7d80ce9e668ac7515f7ebb9da80f3bd8e534d6
Reviewed-on: https://go-review.googlesource.com/22006
Reviewed-by: Ian Lance Taylor <iant@golang.org>
src/fmt/doc.go

index 4eea48eb6b0095ce2eecc7684e7ba6a316ef8657..2f2ee24207d2997e4f53b2c258faa73dc0feff29 100644 (file)
 
        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 it sets the total number of digits. For example,
-       given 123.45 the format %6.2f prints 123.45 while %.4g prints 123.5.
-       The default precision for %e and %f is 6; for %g it is the smallest
-       number of digits necessary to identify the value uniquely.
+       except that for %g/%G precision sets the total number of significant
+       digits. For example, given 12.345 the format %6.3f prints 12.345 while
+       %.3g prints 12.3. The default precision for %e and %f is 6; for %g it
+       is the smallest number of digits necessary to identify the value uniquely.
 
        For complex numbers, the width and precision apply to the two
        components independently and the result is parenthesized, so %f applied