-
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: int: Exp is not consistent with other implementations #8822
Labels
Milestone
Comments
they are just using different semantics of Exp. This is at best a docs issue. http://play.golang.org/p/eeZnsgQuM- |
The result is not wrong here, as such, but the current code means that Exp(x, y, m) != Exp(x, y, nil) followed by Mod(m) -- and that seems unfortunate. The "Python" result does ensure that. The change is, I think, pretty easy (attached). However, I rather suspect that we can't make a subtle change like this in Go 1, esp when it's so easy for the reporter to move the result into the 0 <= x < m range that they want. Owner changed to @agl. Attachments:
|
https://golang.org/cl/145650043 Status changed to Started. |
CL https://golang.org/cl/145650043 mentions this issue. |
This issue was closed by revision 28ddfb0. Status changed to Fixed. |
wheatman
pushed a commit
to wheatman/go-akaros
that referenced
this issue
Jun 25, 2018
The documentation states that Exp(x, y, m) computes x**y mod |m| for m != nil && m > 0. In math.big, Mod is the Euclidean modulus, which is always >= 0. Fixes golang#8822. LGTM=agl, r, rsc R=agl, r, rsc CC=golang-codereviews https://golang.org/cl/145650043
wheatman
pushed a commit
to wheatman/go-akaros
that referenced
this issue
Jun 26, 2018
The documentation states that Exp(x, y, m) computes x**y mod |m| for m != nil && m > 0. In math.big, Mod is the Euclidean modulus, which is always >= 0. Fixes golang#8822. LGTM=agl, r, rsc R=agl, r, rsc CC=golang-codereviews https://golang.org/cl/145650043
wheatman
pushed a commit
to wheatman/go-akaros
that referenced
this issue
Jul 9, 2018
The documentation states that Exp(x, y, m) computes x**y mod |m| for m != nil && m > 0. In math.big, Mod is the Euclidean modulus, which is always >= 0. Fixes golang#8822. LGTM=agl, r, rsc R=agl, r, rsc CC=golang-codereviews https://golang.org/cl/145650043
wheatman
pushed a commit
to wheatman/go-akaros
that referenced
this issue
Jul 30, 2018
The documentation states that Exp(x, y, m) computes x**y mod |m| for m != nil && m > 0. In math.big, Mod is the Euclidean modulus, which is always >= 0. Fixes golang#8822. LGTM=agl, r, rsc R=agl, r, rsc CC=golang-codereviews https://golang.org/cl/145650043
This issue was closed.
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
by hoelle:
The text was updated successfully, but these errors were encountered: