-
Notifications
You must be signed in to change notification settings - Fork 17.9k
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
math/big: AndNot(x,y) doesn't work when x is positive and y is negative #9609
Labels
Milestone
Comments
gopherbot
pushed a commit
that referenced
this issue
Jan 17, 2015
Fixes #9607 Related to #9604 Inadvertently found #9609 Change-Id: I8a8ddf84ac72d3e18986fd8e9288734459f3f174 Reviewed-on: https://go-review.googlesource.com/2962 Reviewed-by: Minux Ma <minux@golang.org>
adg
pushed a commit
that referenced
this issue
Feb 17, 2015
The comment says to use (y-1), but then we did add(y.abs, natOne). We meant sub. Fixes #9609 Change-Id: I4fe4783326ca082c05588310a0af7895a48fc779 Reviewed-on: https://go-review.googlesource.com/2961 Reviewed-by: Robert Griesemer <gri@golang.org> (cherry picked from commit c6ddca2) Reviewed-on: https://go-review.googlesource.com/5001
Not obvious why this was 1.4.2 worthy. |
wheatman
pushed a commit
to wheatman/go-akaros
that referenced
this issue
Jun 25, 2018
The comment says to use (y-1), but then we did add(y.abs, natOne). We meant sub. Fixes golang#9609 Change-Id: I4fe4783326ca082c05588310a0af7895a48fc779 Reviewed-on: https://go-review.googlesource.com/2961 Reviewed-by: Robert Griesemer <gri@golang.org> (cherry picked from commit c6ddca2) Reviewed-on: https://go-review.googlesource.com/5001
wheatman
pushed a commit
to wheatman/go-akaros
that referenced
this issue
Jun 26, 2018
The comment says to use (y-1), but then we did add(y.abs, natOne). We meant sub. Fixes golang#9609 Change-Id: I4fe4783326ca082c05588310a0af7895a48fc779 Reviewed-on: https://go-review.googlesource.com/2961 Reviewed-by: Robert Griesemer <gri@golang.org> (cherry picked from commit c6ddca2) Reviewed-on: https://go-review.googlesource.com/5001
wheatman
pushed a commit
to wheatman/go-akaros
that referenced
this issue
Jul 9, 2018
The comment says to use (y-1), but then we did add(y.abs, natOne). We meant sub. Fixes golang#9609 Change-Id: I4fe4783326ca082c05588310a0af7895a48fc779 Reviewed-on: https://go-review.googlesource.com/2961 Reviewed-by: Robert Griesemer <gri@golang.org> (cherry picked from commit c6ddca2) Reviewed-on: https://go-review.googlesource.com/5001
wheatman
pushed a commit
to wheatman/go-akaros
that referenced
this issue
Jul 20, 2018
The comment says to use (y-1), but then we did add(y.abs, natOne). We meant sub. Fixes golang#9609 Change-Id: I4fe4783326ca082c05588310a0af7895a48fc779 Reviewed-on: https://go-review.googlesource.com/2961 Reviewed-by: Robert Griesemer <gri@golang.org> (cherry picked from commit c6ddca2) Reviewed-on: https://go-review.googlesource.com/5001
wheatman
pushed a commit
to wheatman/go-akaros
that referenced
this issue
Jul 30, 2018
The comment says to use (y-1), but then we did add(y.abs, natOne). We meant sub. Fixes golang#9609 Change-Id: I4fe4783326ca082c05588310a0af7895a48fc779 Reviewed-on: https://go-review.googlesource.com/2961 Reviewed-by: Robert Griesemer <gri@golang.org> (cherry picked from commit c6ddca2) Reviewed-on: https://go-review.googlesource.com/5001
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
package main
import (
"fmt"
"math/big"
)
func main() {
fmt.Println(new(big.Int).AndNot(big.NewInt(0xff), big.NewInt(-1)))
}
This should print 0. It does print 2.
The bug is in math/big/int.go:893, it should use sub, not add, as the comment in the previous line specifies.
The text was updated successfully, but these errors were encountered: