Skip to content

Commit

Permalink
Always return int from Poly.degree
Browse files Browse the repository at this point in the history
Fixes #360. In certain circumstances a `np.int64` was returned from `Poly.degree`. When performing irreducibility checks and computing `q**m`, if either `q` or `m` wasn't an `int` the arithmetic could overflow and the irreducibility check became erroneous.
  • Loading branch information
mhostetter committed May 16, 2022
1 parent c5d930d commit 197c28e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion galois/_polys/_poly.py
Original file line number Diff line number Diff line change
Expand Up @@ -1513,7 +1513,7 @@ def degree(self) -> int:
if self._nonzero_degrees.size == 0:
self._degree = 0
else:
self._degree = max(self._nonzero_degrees)
self._degree = int(max(self._nonzero_degrees))
elif hasattr(self, "_integer"):
if self._integer == 0:
self._degree = 0
Expand Down

0 comments on commit 197c28e

Please sign in to comment.