]> Cypherpunks repositories - gostls13.git/commitdiff
math/big: document Int.String
authorBrian Kessler <brian.m.kessler@gmail.com>
Fri, 3 May 2019 02:37:27 +0000 (20:37 -0600)
committerRobert Griesemer <gri@golang.org>
Fri, 3 May 2019 03:25:26 +0000 (03:25 +0000)
Int.String had no documentation and the documentation for Int.Text
did not mention the handling of the nil pointer case.

Change-Id: I9f21921e431c948545b7cabc7829e4b4e574bbe9
Reviewed-on: https://go-review.googlesource.com/c/go/+/175118
Reviewed-by: Robert Griesemer <gri@golang.org>
src/math/big/intconv.go

index d37d077920f5402502c33171fac5f01d85bbb524..05672841056ddbe2aef939b31a10424e9fcc9500 100644 (file)
@@ -16,7 +16,8 @@ import (
 // Base must be between 2 and 62, inclusive. The result uses the
 // lower-case letters 'a' to 'z' for digit values 10 to 35, and
 // the upper-case letters 'A' to 'Z' for digit values 36 to 61.
-// No prefix (such as "0x") is added to the string.
+// No prefix (such as "0x") is added to the string. If x is a nil
+// pointer it returns "<nil>".
 func (x *Int) Text(base int) string {
        if x == nil {
                return "<nil>"
@@ -33,6 +34,8 @@ func (x *Int) Append(buf []byte, base int) []byte {
        return append(buf, x.abs.itoa(x.neg, base)...)
 }
 
+// String returns the decimal representation of x as generated by
+// x.Text(10).
 func (x *Int) String() string {
        return x.Text(10)
 }