We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
$ gotip version go version devel +a93a124 Tue May 31 15:33:01 2016 +0200 linux/amd64
The documentation of the (x *Float) Text(format byte, prec int) string function says
(x *Float) Text(format byte, prec int) string
A negative precision selects the smallest number of decimal digits necessary to identify the value x uniquely.
This is true for -11 < prec < 0, but for prec < -10 the function panics instead:
-11 < prec < 0
prec < -10
package main import ( "fmt" "math/big" ) func main() { z := new(big.Float).SetRat(big.NewRat(1, 3)) fmt.Println(z.Text('f', -11)) }
playground link.
panic: runtime error: makeslice: cap out of range goroutine 1 [running]: panic(0x1886a0, 0x1040a138) /usr/local/go/src/runtime/panic.go:481 +0x700 math/big.(*Float).Text(0x10427f70, 0x10430266, 0xfffffff5, 0x0, 0x0, 0x0) /usr/local/go/src/math/big/ftoa.go:45 +0x60 main.main() /tmp/sandbox979738453/main.go:10 +0xa0
The text was updated successfully, but these errors were encountered:
I have a simple patch, will send for go1.8.
Sorry, something went wrong.
If it's simple enough, send it to me now, please.
Sent https://go-review.googlesource.com/#/c/23633/
CL https://golang.org/cl/23633 mentions this issue.
5db44c1
No branches or pull requests
The documentation of the
(x *Float) Text(format byte, prec int) string
function saysThis is true for
-11 < prec < 0
, but forprec < -10
the function panics instead:playground link.
The text was updated successfully, but these errors were encountered: