mirror of https://github.com/golang/go.git
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 <bradfitz@golang.org>
This commit is contained in:
parent
6e9f664b9a
commit
33caf3be83
|
|
@ -38,8 +38,8 @@ func (z *Rat) Scan(s fmt.ScanState, ch rune) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetString sets z to the value of s and returns z and a boolean indicating
|
// SetString sets z to the value of s and returns z and a boolean indicating
|
||||||
// success. s can be given as a fraction "a/b" or as a floating-point number
|
// success. s can be given as a fraction "a/b" or as a decimal floating-point
|
||||||
// optionally followed by an exponent. The entire string (not just a prefix)
|
// number optionally followed by an exponent. The entire string (not just a prefix)
|
||||||
// must be valid for success. If the operation failed, the value of z is
|
// must be valid for success. If the operation failed, the value of z is
|
||||||
// undefined but the returned value is nil.
|
// undefined but the returned value is nil.
|
||||||
func (z *Rat) SetString(s string) (*Rat, bool) {
|
func (z *Rat) SetString(s string) (*Rat, bool) {
|
||||||
|
|
@ -78,6 +78,7 @@ func (z *Rat) SetString(s string) (*Rat, bool) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// mantissa
|
// mantissa
|
||||||
|
// TODO(gri) allow other bases besides 10 for mantissa and exponent? (issue #29799)
|
||||||
var ecorr int
|
var ecorr int
|
||||||
z.a.abs, _, ecorr, err = z.a.abs.scan(r, 10, true)
|
z.a.abs, _, ecorr, err = z.a.abs.scan(r, 10, true)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue