-
-
Notifications
You must be signed in to change notification settings - Fork 656
Closed
Description
Is there an existing issue for this?
- I have searched the existing issues for a bug report that matches the one I want to file, without success.
Did you read the documentation and troubleshoot guide?
- I have read the documentation and troubleshoot guide
Environment
- **Fedora, Ubuntu**:
- **10.0.beta4**:
Steps To Reproduce
See below (Additional info) for an easy reproducer at Sage prompt:
build 10.0.beta4 and run
./sage -tp --random-seed=11559027636060728728796865698718805166 src/sage/quadratic_forms/binary_qf.py
on #35290 (where I was lucky to get this random seed), and also reproducible on Fedora box, an error as below.
OK with several other seeds.
Expected Behavior
no error
Actual Behavior
Doctesting 1 file using 8 threads.
sage -t --random-seed=11559027636060728728796865698718805166 src/sage/quadratic_forms/binary_qf.py
**********************************************************************
File "src/sage/quadratic_forms/binary_qf.py", line 1597, in sage.quadratic_forms.binary_qf.BinaryQF.solve_integer
Failed example:
xy = Q.solve_integer(n)
Exception raised:
Traceback (most recent call last):
File "/home/scratch/scratch2/dimpase/sage/sage/src/sage/doctest/forker.py", line 695, in _run
self.compile_and_execute(example, compiler, test.globs)
File "/home/scratch/scratch2/dimpase/sage/sage/src/sage/doctest/forker.py", line 1093, in compile_and_execute
exec(compiled, globs)
File "<doctest sage.quadratic_forms.binary_qf.BinaryQF.solve_integer[18]>", line 1, in <module>
xy = Q.solve_integer(n)
File "/home/scratch/scratch2/dimpase/sage/sage/src/sage/quadratic_forms/binary_qf.py", line 1634, in solve_integer
y = y_num // Q._b
File "sage/structure/element.pyx", line 1838, in sage.structure.element.Element.__floordiv__
return (<Element>left)._floordiv_(right)
File "sage/rings/integer.pyx", line 2091, in sage.rings.integer.Integer._floordiv_
raise ZeroDivisionError("Integer division by zero")
ZeroDivisionError: Integer division by zero
**********************************************************************
File "src/sage/quadratic_forms/binary_qf.py", line 1598, in sage.quadratic_forms.binary_qf.BinaryQF.solve_integer
Failed example:
Q(*xy) == n
Exception raised:
Traceback (most recent call last):
File "/home/scratch/scratch2/dimpase/sage/sage/src/sage/doctest/forker.py", line 695, in _run
self.compile_and_execute(example, compiler, test.globs)
File "/home/scratch/scratch2/dimpase/sage/sage/src/sage/doctest/forker.py", line 1093, in compile_and_execute
exec(compiled, globs)
File "<doctest sage.quadratic_forms.binary_qf.BinaryQF.solve_integer[19]>", line 1, in <module>
Q(*xy) == n
TypeError: 207872*x^2 - 2156672*x*y + 5593868*y^2 argument after * must be an iterable, not NoneType
**********************************************************************
1 item had failures:
2 of 23 in sage.quadratic_forms.binary_qf.BinaryQF.solve_integer
[313 tests, 2 failures, 0.21 s]
----------------------------------------------------------------------
sage -t --random-seed=11559027636060728728796865698718805166 src/sage/quadratic_forms/binary_qf.py # 2 doctests failed
----------------------------------------------------------------------
Additional Information
here is the reproducer without random stuff - obtained by printing values in the test for the
random seed in question:
sage: RR.<x,y>=ZZ[]
sage: Q=BinaryQF(207872*x^2 - 2156672*x*y + 5593868*y^2)
sage: Q.solve_integer(812)
---------------------------------------------------------------------------
ZeroDivisionError Traceback (most recent call last)
Cell In [10], line 1
----> 1 Q.solve_integer(Integer(812))
File /home/scratch/scratch2/dimpase/sage/sage/src/sage/quadratic_forms/binary_qf.py:1638, in BinaryQF.solve_integer(self, n)
1636 y_num = n // x - Q._a * x
1637 if Q._b.divides(y_num):
-> 1638 y = y_num // Q._b
1639 return tuple(row[0]*x + row[1]*y for row in M.rows())
1641 return None
File /home/scratch/scratch2/dimpase/sage/sage/src/sage/structure/element.pyx:1838, in sage.structure.element.Element.__floordiv__()
1836 cdef int cl = classify_elements(left, right)
1837 if HAVE_SAME_PARENT(cl):
-> 1838 return (<Element>left)._floordiv_(right)
1839 if BOTH_ARE_ELEMENT(cl):
1840 return coercion_model.bin_op(left, right, floordiv)
File /home/scratch/scratch2/dimpase/sage/sage/src/sage/rings/integer.pyx:2091, in sage.rings.integer.Integer._floordiv_()
2089 """
2090 if not mpz_sgn((<Integer>right).value):
-> 2091 raise ZeroDivisionError("Integer division by zero")
2092
2093 cdef Integer z = <Integer>PY_NEW(Integer)
ZeroDivisionError: Integer division by zero