-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
[resubmit] Fix bug of FastReducer used in BigInteger.ModPow #55122
Closed
Closed
Changes from 7 commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
949fef4
fix formula in comment
key-moon 6d3345a
add test for FastReducer boundary case
key-moon 9c967ba
fix size of buffer used in FastReducer
key-moon c8d064d
Add testcase to boundary test
key-moon 5626f23
fix assertion error in SubMod function
key-moon 05b78c1
reduce k from k + 1
key-moon a66b571
Fix function name and description
key-moon 1e07f92
Merge branch 'main' into 'fix-fastreducer'
key-moon bdc5196
Add assertion for SubMod
key-moon a53f36e
fix scale of k
key-moon 9b9d398
Merge branch 'main' of github:dotnet/runtime into fix-fastreducer
key-moon File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you explain why
base
is2^32
, which I'm interpreting as4294967296
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The formula in the comment changed because the following formula is not correct. It should be
v/2^(k-32) * mu
.runtime/src/libraries/System.Runtime.Numerics/src/System/Numerics/BigIntegerCalculator.FastReducer.cs
Lines 55 to 57 in b759ac9
Instead of change
(k-1)
to(k-32)
, I choose to changebase
to2^32
from2
because the base of the number notation in this code is2^32
. If you write as2^(k-32)
, I think it is more harder to understand because the reader doesn't sure where32
came from.But I can understand why you prefer base
2
. So, what about//Let r = 2^(32*2*k), with 2^(32*2*k) > m
instead of2^(2k)
or(2^32)^(2k)
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd prefer to keep this inline with the paper and just use
2^(k-32)
. We can leave a comment that its 32 because we operate on 32-bits at a time