Skip to content

Commit 33caf3b

Browse files
committed
math/big: document that Rat.SetString accepts _decimal_ float representations
Updates #29799. Change-Id: I267c2c3ba3964e96903954affc248d0c52c4916c Reviewed-on: https://go-review.googlesource.com/c/158397 Reviewed-by: Brad Fitzpatrick <[email protected]>
1 parent 6e9f664 commit 33caf3b

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/math/big/ratconv.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ func (z *Rat) Scan(s fmt.ScanState, ch rune) error {
3838
}
3939

4040
// SetString sets z to the value of s and returns z and a boolean indicating
41-
// success. s can be given as a fraction "a/b" or as a floating-point number
42-
// optionally followed by an exponent. The entire string (not just a prefix)
41+
// success. s can be given as a fraction "a/b" or as a decimal floating-point
42+
// number optionally followed by an exponent. The entire string (not just a prefix)
4343
// must be valid for success. If the operation failed, the value of z is
4444
// undefined but the returned value is nil.
4545
func (z *Rat) SetString(s string) (*Rat, bool) {
@@ -78,6 +78,7 @@ func (z *Rat) SetString(s string) (*Rat, bool) {
7878
}
7979

8080
// mantissa
81+
// TODO(gri) allow other bases besides 10 for mantissa and exponent? (issue #29799)
8182
var ecorr int
8283
z.a.abs, _, ecorr, err = z.a.abs.scan(r, 10, true)
8384
if err != nil {

0 commit comments

Comments
 (0)