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

u32 modulo fix #112

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

u32 modulo fix #112

wants to merge 3 commits into from

Conversation

mizar
Copy link
Collaborator

@mizar mizar commented Jan 20, 2023

#111

Fix a problem with cases like 2^31 < modulo < 2^32 due to poor implementation of ac-library's overflow/underflow check.

@mizar mizar mentioned this pull request Jan 21, 2023
@mizar mizar force-pushed the u32mod branch 4 times, most recently from 6428bd4 to 9dca5a2 Compare January 22, 2023 03:19
@mizar
Copy link
Collaborator Author

mizar commented Jan 22, 2023

Rebased commit to current rust-lang-ja:master.

@mizar
Copy link
Collaborator Author

mizar commented Jan 22, 2023

@TonalidadeHidrica
Copy link
Collaborator

@mizar Does this fix correspond to a PR in atcoder/ac-library, or is this an original improvement?

@qryxip qryxip mentioned this pull request Apr 1, 2023
@mizar
Copy link
Collaborator Author

mizar commented Apr 10, 2023

@TonalidadeHidrica
atcoder/ac-library#149
I have sent an issue to ac-library, but have not yet sent a pull request.

@mizar
Copy link
Collaborator Author

mizar commented Apr 15, 2023

This proposed change has been incorporated into ACL 1.5.1 and is expected to be available in the 202301 language update for C++.

src/modint.rs Outdated Show resolved Hide resolved
@mizar
Copy link
Collaborator Author

mizar commented Apr 19, 2023

Regarding the proposed 2^31 <= m < 2^32 response to ModInt addition and subtraction, the response was as follows.

atcoder/ac-library#164 (comment)

Thanks for suggestion, but we don't have a plan to extend mod range to m < 2^32. As far as I know, at least 99% usage of modint is m < 2^31. TBH I don't came up any recent problems that requires 2^31 < m < 2^32. So, we prefer to prepare m < 2^31 modint rather than m < 2^32 modint with tricky technique.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

mul_mod for 2^31 < m < 2^32 Corner cases of "modint" when mod = 1
2 participants