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

Commit

Permalink
sage_input for infinities
Browse files Browse the repository at this point in the history
  • Loading branch information
Matthias Koeppe committed Feb 18, 2017
1 parent 03f3642 commit 1543f32
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions src/sage/rings/infinity.py
Original file line number Diff line number Diff line change
Expand Up @@ -544,6 +544,25 @@ def lcm(self, x):
else:
return abs(self)

def _sage_input_(self, sib, coerced):
"""
Produce an expression which will reproduce this value when evaluated.
TESTS::
sage: sage_input(-oo)
-oo
sage: sage_input(oo)
oo
sage: sage_input(unsigned_infinity)
unsigned_infinity
"""
if self._sign == 0:
return sib.name('unsigned_infinity')
elif self._sign > 0:
return sib.name('oo')
else:
return -sib.name('oo')

class UnsignedInfinityRing_class(Singleton, Ring):

Expand Down

0 comments on commit 1543f32

Please sign in to comment.