Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Trac #30695: Padic slice method fails on exact zeros for certain inputs
Using version 9.2.beta14 of Sage, the p-adic `slice` method fails on exact zeros, for input of j=None or j=infinity (where j is the 'upper- bound' of the slice). [[br]] For example: {{{ sage: F=Qp(3) sage: a=F(0) sage: a.slice(0,None) ------------------------------------------------------------------------ --- SignError Traceback (most recent call last) <ipython-input-4-d78676a03c88> in <module> ----> 1 a.slice(Integer(0),None) ~/workspace/padic_project/sage/local/lib/python3.7/site- packages/sage/rings/padics/local_generic_element.pyx in sage.rings.padics.local_generic_element.LocalGenericElement.slice (build/cythonized/sage/rings/padics/local_generic_element.c:3430)() 329 if self.parent().is_field(): 330 start -= self.valuation() --> 331 stop -= self.valuation() 332 333 # make sure that start and stop are non-negative ~/workspace/padic_project/sage/local/lib/python3.7/site- packages/sage/structure/element.pyx in sage.structure.element.Element.__sub__ (build/cythonized/sage/structure/element.c:11514)() 1353 cdef int cl = classify_elements(left, right) 1354 if HAVE_SAME_PARENT(cl): -> 1355 return (<Element>left)._sub_(right) 1356 if BOTH_ARE_ELEMENT(cl): 1357 return coercion_model.bin_op(left, right, sub) ~/workspace/padic_project/sage/local/lib/python3.7/site- packages/sage/structure/element.pyx in sage.structure.element.ModuleElement._sub_ (build/cythonized/sage/structure/element.c:15803)() 2386 return coercion_model.bin_op(self, n, add) 2387 -> 2388 cpdef _sub_(self, other): 2389 """ 2390 Default implementation of subtraction using addition and ~/workspace/padic_project/sage/local/lib/python3.7/site- packages/sage/rings/infinity.py in _sub_(self, other) 426 raise SignError("cannot subtract unsigned infinities") 427 elif self._sign == other._sign: --> 428 raise SignError("cannot add infinity to minus infinity") 429 return self 430 SignError: cannot add infinity to minus infinity sage: a.slice(0,infinity) ------------------------------------------------------------------------ --- SignError Traceback (most recent call last) <ipython-input-5-98f115011f22> in <module> ----> 1 a.slice(Integer(0),infinity) ~/workspace/padic_project/sage/local/lib/python3.7/site- packages/sage/rings/padics/local_generic_element.pyx in sage.rings.padics.local_generic_element.LocalGenericElement.slice (build/cythonized/sage/rings/padics/local_generic_element.c:3430)() 329 if self.parent().is_field(): 330 start -= self.valuation() --> 331 stop -= self.valuation() 332 333 # make sure that start and stop are non-negative ~/workspace/padic_project/sage/local/lib/python3.7/site- packages/sage/structure/element.pyx in sage.structure.element.Element.__sub__ (build/cythonized/sage/structure/element.c:11514)() 1353 cdef int cl = classify_elements(left, right) 1354 if HAVE_SAME_PARENT(cl): -> 1355 return (<Element>left)._sub_(right) 1356 if BOTH_ARE_ELEMENT(cl): 1357 return coercion_model.bin_op(left, right, sub) ~/workspace/padic_project/sage/local/lib/python3.7/site- packages/sage/structure/element.pyx in sage.structure.element.ModuleElement._sub_ (build/cythonized/sage/structure/element.c:15803)() 2386 return coercion_model.bin_op(self, n, add) 2387 -> 2388 cpdef _sub_(self, other): 2389 """ 2390 Default implementation of subtraction using addition and ~/workspace/padic_project/sage/local/lib/python3.7/site- packages/sage/rings/infinity.py in _sub_(self, other) 426 raise SignError("cannot subtract unsigned infinities") 427 elif self._sign == other._sign: --> 428 raise SignError("cannot add infinity to minus infinity") 429 return self 430 SignError: cannot add infinity to minus infinity }}} URL: https://trac.sagemath.org/30695 Reported by: gh-n-vi Ticket author(s): Noa Viner Reviewer(s): Julian Rüth
- Loading branch information