Skip to content
New issue

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

big: Rat.Quo problem with receiver in second argument #820

Closed
gopherbot opened this issue May 29, 2010 · 3 comments
Closed

big: Rat.Quo problem with receiver in second argument #820

gopherbot opened this issue May 29, 2010 · 3 comments

Comments

@gopherbot
Copy link
Contributor

by soniakeys:

What steps will reproduce the problem?
1.
package main
import ("big"; "fmt")
func main() {
        x := big.NewRat(2,1)
        fmt.Println(x.Quo(big.NewRat(3,1), x))
}
2. 6g; 6l; 6.out

What is the expected output? What do you see instead?
expected: 3/2
instead: 1

What is your $GOOS?  $GOARCH?
linux amd64

Which revision are you using?  (hg identify)
d745d21ef536 tip

Please provide any additional information below.
arguments the other way, x.Quo(x, big.NewRat(3,1)), gives correct answer of 
2/3
@adg
Copy link
Contributor

adg commented May 31, 2010

Comment 1:

Confirmed.
--
package main
import (
    "big"
    "fmt"
)
func main() {
    x := big.NewRat(2, 1)
    y := big.NewRat(3, 1)
    fmt.Println(x.Quo(y, x))
    fmt.Println(x.Quo(x, y))
}
--
$ ./6.out 
1
1/3

Owner changed to g...@golang.org.

Status changed to Accepted.

@edsrzf
Copy link

edsrzf commented Jun 1, 2010

Comment 2:

adg's reproduction case is a little misleading. The x.Quo(y, x) actually modifies x,
so the x.Quo(x, y) isn't the symmetric operation it looks to be.
There is a bug, though. I think it's an aliasing problem. I'll a more thorough look
at it a little later today.

@griesemer
Copy link
Contributor

Comment 3:

This issue was closed by revision ab215f7.

Status changed to Fixed.

@golang golang locked and limited conversation to collaborators Jun 24, 2016
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants