-
-
Notifications
You must be signed in to change notification settings - Fork 528
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
gh-37201: Fix univariate polynomial reverse
For univariate polynomials over "non-prime" finite fields, the reverse method had an issue when specifying `degree=0`: it raised an error saying that this optional argument should be... nonnegative (which 0 is). Example: ``` sage: ring.<x> = GF(9)[] sage: pol = ring(1) sage: pol.reverse(degree=2) x^2 sage: pol.reverse() 1 sage: pol.reverse(degree=0) ------------------------------------------------------------------------ --- ValueError Traceback (most recent call last) Cell In[5], line 1 ----> 1 pol.reverse(degree=Integer(0)) File ~/repositories/software/sage/src/sage/rings/polynomial/polynomial_z z_pex.pyx:537, in sage.rings.polynomial.polynomial_zz_pex.Polynomial_ZZ_pEX.reverse() 535 if degree is not None: 536 if degree <= 0: --> 537 raise ValueError("degree argument must be a non-negative integer, got %s" % (degree)) 538 try: 539 d = degree ValueError: degree argument must be a non-negative integer, got 0 ``` This is fixed in this PR, along with fixes in similar code where the error message was not the expected one ("cannot convert to long", instead of "degree must be nonnegative"). URL: #37201 Reported by: Vincent Neiger Reviewer(s): Xavier Caruso
- Loading branch information
Showing
5 changed files
with
21 additions
and
11 deletions.
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
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
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