Skip to content
This repository has been archived by the owner on Jan 30, 2023. It is now read-only.

Commit

Permalink
src/sage/symbolic/pynac_impl.pxi (py_is_integer, py_is_exact): Handle…
Browse files Browse the repository at this point in the history
… symbolic subrings like SR
  • Loading branch information
Matthias Koeppe committed Nov 1, 2021
1 parent 5fca7fc commit 038eb9f
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions src/sage/symbolic/pynac_impl.pxi
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,6 @@ cdef subs_args_to_PyTuple(const GExMap& map, unsigned options, const GExVector&
<class 'sage.symbolic.expression.Expression'>]
x
"""
from sage.symbolic.ring import SR
res = []
res.append(new_SubstitutionMap_from_GExMap(map))
res.append(options)
Expand Down Expand Up @@ -1118,6 +1117,10 @@ cdef bint py_is_integer(x):
True
sage: py_is_integer(SR(5))
True
sage: SCR = SR.subring(no_variables=True); SCR
Symbolic Constants Subring
sage: py_is_integer(SCR(5))
True
sage: py_is_integer(4/2)
True
sage: py_is_integer(QQbar(sqrt(2))^2)
Expand All @@ -1132,8 +1135,8 @@ cdef bint py_is_integer(x):
if not isinstance(x, Element):
return False
P = (<Element>x)._parent
from .ring import SR
return (P is SR or P.is_exact()) and x in ZZ
from .ring import SymbolicRing
return (isinstance(P, SymbolicRing) or P.is_exact()) and x in ZZ


def py_is_integer_for_doctests(x):
Expand Down Expand Up @@ -1221,8 +1224,8 @@ cdef bint py_is_exact(x):
if not isinstance(x, Element):
return False
P = (<Element>x)._parent
from .ring import SR
return P is SR or P.is_exact()
from .ring import SymbolicRing
return isinstance(P, SymbolicRing) or P.is_exact()


cdef py_numer(n):
Expand Down

0 comments on commit 038eb9f

Please sign in to comment.