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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix ZeroDivisionError in gcd of sparse polynomials #36445

Merged
merged 1 commit into from
Oct 21, 2023

Conversation

DaveWitteMorris
Copy link
Member

Fixes #36427

As pointed out in #36427, attempting to calculate the gcd of two sparse polynomials raises a ZeroDivisionError if one of the polynomials is constant, and the other has large degree (at least 100).

This is caused by an error in the code that tests whether converting either of the polynomials to FLINT will be very slow. To fix this, we check each polynomial individually, instead of trying to consider both polynomials at once.

馃摑 Checklist

  • The title is concise, informative, and self-explanatory.
  • 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.

@jhpalmieri
Copy link
Member

Looks good to me.

@DaveWitteMorris
Copy link
Member Author

Thanks, John!

vbraun pushed a commit to vbraun/sage that referenced this pull request Oct 15, 2023
    
Fixes sagemath#36427

As pointed out in sagemath#36427, attempting to calculate the gcd of two sparse
polynomials raises a `ZeroDivisionError` if one of the polynomials is
constant, and the other has large degree (at least 100).

This is caused by an error in the code that tests whether converting
either of the polynomials to FLINT will be very slow. To fix this, we
check each polynomial individually, instead of trying to consider both
polynomials at once.

### 馃摑 Checklist

- [x] The title is concise, informative, and self-explanatory.
- [x] The description explains in detail what this PR is about.
- [x] I have linked a relevant issue or discussion.
- [x] I have created tests covering the changes.
    
URL: sagemath#36445
Reported by: DaveWitteMorris
Reviewer(s): John H. Palmieri
vbraun pushed a commit to vbraun/sage that referenced this pull request Oct 17, 2023
    
Fixes sagemath#36427

As pointed out in sagemath#36427, attempting to calculate the gcd of two sparse
polynomials raises a `ZeroDivisionError` if one of the polynomials is
constant, and the other has large degree (at least 100).

This is caused by an error in the code that tests whether converting
either of the polynomials to FLINT will be very slow. To fix this, we
check each polynomial individually, instead of trying to consider both
polynomials at once.

### 馃摑 Checklist

- [x] The title is concise, informative, and self-explanatory.
- [x] The description explains in detail what this PR is about.
- [x] I have linked a relevant issue or discussion.
- [x] I have created tests covering the changes.
    
URL: sagemath#36445
Reported by: DaveWitteMorris
Reviewer(s): John H. Palmieri
@vbraun vbraun merged commit fec8357 into sagemath:develop Oct 21, 2023
22 of 32 checks passed
@mkoeppe mkoeppe added this to the sage-10.2 milestone Oct 21, 2023
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.

sparse polynomial passing to the fraction field raises ZeroDivisionError
4 participants