-
Notifications
You must be signed in to change notification settings - Fork 18.7k
Closed
Labels
Description
What version of Go are you using (go version)?
1.11.2
Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (go env)?
go env Output
$ go env GOHOSTARCH="amd64" GOHOSTOS="linux"
What did you do?
func main() {
var x, y big.Rat
x = *big.NewRat(123456789, 1)
y.SetString("123456789")
fmt.Printf("%#v\n", x)
fmt.Printf("%#v\n", y)
}
https://play.golang.org/p/yFKM2k6djNA
What did you expect to see?
I would expect to see both structures be identical.
big.Rat{a:big.Int{neg:false, abs:big.nat{0x75bcd15}}, b:big.Int{neg:false, abs:big.nat{}}}
big.Rat{a:big.Int{neg:false, abs:big.nat{0x75bcd15}}, b:big.Int{neg:false, abs:big.nat{}}}
What did you see instead?
While the same numerical value, they are different for the purposes of test assertion.
big.Rat{a:big.Int{neg:false, abs:big.nat{0x75bcd15}}, b:big.Int{neg:false, abs:big.nat{}}}
big.Rat{a:big.Int{neg:false, abs:big.nat{0x75bcd15}}, b:big.Int{neg:false, abs:big.nat(nil)}}