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

math/big: modInverse doesn't require a prime modulus #8875

Closed
randall77 opened this issue Oct 6, 2014 · 3 comments
Closed

math/big: modInverse doesn't require a prime modulus #8875

randall77 opened this issue Oct 6, 2014 · 3 comments

Comments

@randall77
Copy link
Contributor

The spec of math/big.modInverse requires the modulus to be prime.  But the inverse is
well defined as long as the number being inverted and the modulus are relatively prime. 
Perhaps more importantly, the current code seems to work for all of those cases.

Should we relax the spec to include these cases?
Any reason why the current code wouldn't always work with this relaxation?
@agl
Copy link
Contributor

agl commented Oct 6, 2014

Comment 1:

There's no problem with relaxing that, but the prime modulus case was the only one that
I cared about and tested and thus the only one that I wanted to commit to.

@gopherbot
Copy link

Comment 2:

CL https://golang.org/cl/155010043 mentions this issue.

@randall77
Copy link
Contributor Author

Comment 3:

This issue was closed by revision 96d1e4a.

Status changed to Fixed.

@golang golang locked and limited conversation to collaborators Jun 25, 2016
wheatman pushed a commit to wheatman/go-akaros that referenced this issue Jun 25, 2018
The inverse is defined whenever the element and the
modulus are relatively prime.  The code already handles
this situation, but the spec does not.

Test that it does indeed work.

Fixes golang#8875

LGTM=agl
R=agl
CC=golang-codereviews
https://golang.org/cl/155010043
wheatman pushed a commit to wheatman/go-akaros that referenced this issue Jun 26, 2018
The inverse is defined whenever the element and the
modulus are relatively prime.  The code already handles
this situation, but the spec does not.

Test that it does indeed work.

Fixes golang#8875

LGTM=agl
R=agl
CC=golang-codereviews
https://golang.org/cl/155010043
wheatman pushed a commit to wheatman/go-akaros that referenced this issue Jul 9, 2018
The inverse is defined whenever the element and the
modulus are relatively prime.  The code already handles
this situation, but the spec does not.

Test that it does indeed work.

Fixes golang#8875

LGTM=agl
R=agl
CC=golang-codereviews
https://golang.org/cl/155010043
wheatman pushed a commit to wheatman/go-akaros that referenced this issue Jul 30, 2018
The inverse is defined whenever the element and the
modulus are relatively prime.  The code already handles
this situation, but the spec does not.

Test that it does indeed work.

Fixes golang#8875

LGTM=agl
R=agl
CC=golang-codereviews
https://golang.org/cl/155010043
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

3 participants