Skip to content

Avoid overflow in passing large exponents to singular #40455

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

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from

Conversation

user202729
Copy link
Contributor

@user202729 user202729 commented Jul 20, 2025

Fixes #40442

I don't know what the output would be in 32-bit.

I think it's justified to change singular_polynomial_pow's exp parameter type from unsigned long to int, because previously it didn't work for int anyway (since singular's pPower takes int parameter). We could keep making it take unsigned long and do the divmod INT_MAX at low level, but I find it easier to do that at high level (Python), where, as can be seen from this pull request, that takes only 3 lines of code.

I think it's completely impractical to raise anything except monomials to power larger than 2^31 anyway. Except maybe (x+y)^2^n mod 2, but that can only be quickly calculated when internally repeated squaring is used.

📝 Checklist

  • The title is concise and informative.
  • The description explains in detail what this PR is about.
  • I have linked a relevant issue or discussion.
  • I have created tests covering the changes.
  • I have updated the documentation and checked the documentation preview.

⌛ Dependencies

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

Successfully merging this pull request may close these issues.

Exponent overflow
1 participant