Skip to content

Commit

Permalink
Trac #33801: sage.misc.sage_input: Remove import from sage.all
Browse files Browse the repository at this point in the history
URL: https://trac.sagemath.org/33801
Reported by: mkoeppe
Ticket author(s): Matthias Koeppe
Reviewer(s): Frédéric Chapoton
  • Loading branch information
Release Manager committed May 24, 2022
2 parents 2649fa7 + 73f4ab7 commit 028e704
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/sage/misc/sage_input.py
Expand Up @@ -481,18 +481,20 @@ def __call__(self, x, coerced=False):
# floats could often have prettier output,
# but I think they're rare enough in Sage that it's not
# worth the effort.
from sage.all import RR, ZZ, infinity
if x == float(infinity):
from math import inf
if x == inf:
return self.name('float')(self.name('infinity'))
if x != x:
return self.name('float')(self.name('NaN'))
if x == -float(infinity):
if x == -inf:
return -self.name('float')(self.name('infinity'))
if self._preparse is False and float(str(x)) == x:
if x < 0:
return -SIE_literal_stringrep(self, str(-x))
else:
return SIE_literal_stringrep(self, str(x))
from sage.rings.real_mpfr import RR
from sage.rings.integer_ring import ZZ
rrx = RR(x)
if rrx in ZZ and abs(rrx) < (1 << 53):
return self.name('float')(self.int(ZZ(rrx)))
Expand Down

0 comments on commit 028e704

Please sign in to comment.