math/big: Allow non-prime modulus for ModInverse
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 issue 8875
On 2014/10/06 22:25:13, khr wrote: > Hello mailto:agl@golang.org (cc: mailto:golang-codereviews@googlegroups.com), > > I'd like you ...
9 years, 6 months ago
(2014-10-13 20:48:47 UTC)
#2
On 2014/10/06 22:25:13, khr wrote:
> Hello mailto:agl@golang.org (cc: mailto:golang-codereviews@googlegroups.com),
>
> I'd like you to review this change to
> https://khr%40golang.org@code.google.com/p/go/
Ping.
Sorry, had drafts but forgot to hit publish. https://codereview.appspot.com/155010043/diff/40001/src/math/big/int.go File src/math/big/int.go (right): https://codereview.appspot.com/155010043/diff/40001/src/math/big/int.go#newcode756 src/math/big/int.go:756: // ...
9 years, 6 months ago
(2014-10-13 21:05:31 UTC)
#3
On 2014/10/13 21:05:31, agl1 wrote: > Sorry, had drafts but forgot to hit publish. > ...
9 years, 6 months ago
(2014-10-13 21:15:33 UTC)
#4
On 2014/10/13 21:05:31, agl1 wrote:
> Sorry, had drafts but forgot to hit publish.
>
> https://codereview.appspot.com/155010043/diff/40001/src/math/big/int.go
> File src/math/big/int.go (right):
>
>
https://codereview.appspot.com/155010043/diff/40001/src/math/big/int.go#newco...
> src/math/big/int.go:756: // and returns z. g and n must be relatively prime.
> only one space after a period in this package.
>
> Sentences should start with a capital letter. What about "The arguments g and
n
> must be relatively prime or the result is undefined."
How about "If g and n are not relatively prime, the result is undefined." It
matches the undefined language in, e.g., Int64().
*** Submitted as https://code.google.com/p/go/source/detail?r=9825b678db2f *** math/big: Allow non-prime modulus for ModInverse The inverse is defined ...
9 years, 6 months ago
(2014-10-14 21:09:59 UTC)
#6
*** Submitted as https://code.google.com/p/go/source/detail?r=9825b678db2f ***
math/big: Allow non-prime modulus for ModInverse
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 issue 8875
LGTM=agl
R=agl
CC=golang-codereviews
https://codereview.appspot.com/155010043
Issue 155010043: code review 155010043: math/big: Allow non-prime modulus for ModInverse
(Closed)
Created 9 years, 7 months ago by khr
Modified 9 years, 6 months ago
Reviewers: gobot
Base URL:
Comments: 1