Skip to content

Commit

Permalink
Trac #32625: Parent._is_numerical, _is_real_numerical - remove hard d…
Browse files Browse the repository at this point in the history
…ependency on real_mpfr, complex_mpfr

This is for '''sagemath-polyhedra''' (#32432), which does not include
the floating point fields

URL: https://trac.sagemath.org/32625
Reported by: mkoeppe
Ticket author(s): Matthias Koeppe
Reviewer(s): Travis Scrimshaw
  • Loading branch information
Release Manager committed Oct 29, 2021
2 parents c855f39 + bf0ed1d commit e3c14c2
Showing 1 changed file with 19 additions and 5 deletions.
24 changes: 19 additions & 5 deletions src/sage/structure/parent.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -2812,9 +2812,16 @@ cdef class Parent(sage.structure.category_object.CategoryObject):
sage: [R._is_numerical() for R in [RIF, RBF, CIF, CBF]]
[False, False, False, False]
"""
from sage.rings.complex_mpfr import ComplexField
from sage.rings.real_mpfr import mpfr_prec_min
return ComplexField(mpfr_prec_min()).has_coerce_map_from(self)
try:
from sage.rings.complex_mpfr import ComplexField
from sage.rings.real_mpfr import mpfr_prec_min
except ImportError:
pass
else:
return ComplexField(mpfr_prec_min()).has_coerce_map_from(self)

from sage.rings.real_double import CDF
return CDF.has_coerce_map_from(self)

@cached_method
def _is_real_numerical(self):
Expand All @@ -2833,8 +2840,15 @@ cdef class Parent(sage.structure.category_object.CategoryObject):
sage: [R._is_real_numerical() for R in [RIF, RBF, CIF, CBF]]
[False, False, False, False]
"""
from sage.rings.real_mpfr import RealField, mpfr_prec_min
return RealField(mpfr_prec_min()).has_coerce_map_from(self)
try:
from sage.rings.real_mpfr import RealField, mpfr_prec_min
except ImportError:
pass
else:
return RealField(mpfr_prec_min()).has_coerce_map_from(self)

from sage.rings.real_double import RDF
return RDF.has_coerce_map_from(self)

############################################################################
# Set base class --
Expand Down

0 comments on commit e3c14c2

Please sign in to comment.