Skip to content

Commit 689ee11

Browse files
bmkesslergriesemer
authored andcommitted
math/big: document Int.String
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 <[email protected]>
1 parent 16bf0d5 commit 689ee11

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/math/big/intconv.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ import (
1616
// Base must be between 2 and 62, inclusive. The result uses the
1717
// lower-case letters 'a' to 'z' for digit values 10 to 35, and
1818
// the upper-case letters 'A' to 'Z' for digit values 36 to 61.
19-
// No prefix (such as "0x") is added to the string.
19+
// No prefix (such as "0x") is added to the string. If x is a nil
20+
// pointer it returns "<nil>".
2021
func (x *Int) Text(base int) string {
2122
if x == nil {
2223
return "<nil>"
@@ -33,6 +34,8 @@ func (x *Int) Append(buf []byte, base int) []byte {
3334
return append(buf, x.abs.itoa(x.neg, base)...)
3435
}
3536

37+
// String returns the decimal representation of x as generated by
38+
// x.Text(10).
3639
func (x *Int) String() string {
3740
return x.Text(10)
3841
}

0 commit comments

Comments
 (0)