FAQ
Reviewers: golang-dev_googlegroups.com,

Message:
Hello golang-dev@googlegroups.com,

I'd like you to review this change to
https://code.google.com/p/go/


Description:
fmt: document some undocumented details
Better explanation of width for floating-point values.
Explain that scanning does not handle %#q etc.

Please review this at http://codereview.appspot.com/6620074/

Affected files:
M src/pkg/fmt/doc.go


Index: src/pkg/fmt/doc.go
===================================================================
--- a/src/pkg/fmt/doc.go
+++ b/src/pkg/fmt/doc.go
@@ -56,9 +56,11 @@
character '*', causing their values to be obtained from the next
operand, which must be of type int.

- For numeric values, width sets the width of the field and precision
- sets the number of places after the decimal, if appropriate. For
- example, the format %6.2f prints 123.45.
+ For numeric values, width sets the minimum width of the field and
+ precision sets the number of places after the decimal, if appropriate.
+ For example, the format %6.2f prints 123.45. The default precision for
+ %e and %f is 6; for %g it is the smallest width necessary to identify
+ the value uniquely.

For strings, width is the minimum number of characters to output,
padding with spaces if necessary, and precision is the maximum
@@ -152,6 +154,7 @@
%T is not implemented
%e %E %f %F %g %G are all equivalent and scan any floating point or
complex value
%s and %v on strings scan a space-delimited token
+ Flags # and + are not implemented.

The familiar base-setting prefixes 0 (octal) and 0x
(hexadecimal) are accepted when scanning integers without a

Search Discussions

  • Rob Pike at Oct 8, 2012 at 6:01 am
    Fixes issue 4202.
    Fixes issue 4206.
  • Adg at Oct 8, 2012 at 6:09 am
  • Russ Cox at Oct 8, 2012 at 2:44 pm
    FWIW, the definition of precision is different for %e/%E/%f (digits
    after decimal) than it is for %g/%G (total digits). I am not sure
    exactly how to work that in.
    Also, s/smallest width/smallest number of digits/

    Russ
  • R at Oct 8, 2012 at 11:58 pm
    Hello golang-dev@googlegroups.com, adg@golang.org, rsc@golang.org (cc:
    golang-dev@googlegroups.com),

    Please take another look.


    http://codereview.appspot.com/6620074/
  • Rob Pike at Oct 12, 2012 at 12:19 am
    ping
  • Iant at Oct 12, 2012 at 5:24 am
  • R at Oct 12, 2012 at 6:19 am
    *** Submitted as
    http://code.google.com/p/go/source/detail?r=a9280640383f ***

    fmt: document some undocumented details
    Better explanation of width for floating-point values.
    Explain that scanning does not handle %#q etc.

    Fixes issue 4202.
    Fixes issue 4206.

    R=golang-dev, adg, rsc, iant
    CC=golang-dev
    http://codereview.appspot.com/6620074


    http://codereview.appspot.com/6620074/

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupgolang-dev @
categoriesgo
postedOct 8, '12 at 6:00a
activeOct 12, '12 at 6:19a
posts8
users4
websitegolang.org

4 users in discussion

R: 5 posts Russ Cox: 1 post Iant: 1 post Adg: 1 post

People

Translate

site design / logo © 2022 Grokbase