[Python-checkins] python/nondist/sandbox/decimal Decimal.py,1.1,1.2
jhylton@users.sourceforge.net
jhylton@users.sourceforge.net
Wed, 14 May 2003 15:32:40 -0700
Update of /cvsroot/python/python/nondist/sandbox/decimal
In directory sc8-pr-cvs1:/tmp/cvs-serv14296
Modified Files:
Decimal.py
Log Message:
whitespace normalization and folding long lines.
Index: Decimal.py
===================================================================
RCS file: /cvsroot/python/python/nondist/sandbox/decimal/Decimal.py,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** Decimal.py 2 May 2003 22:50:09 -0000 1.1
--- Decimal.py 14 May 2003 22:32:37 -0000 1.2
***************
*** 744,747 ****
--- 744,748 ----
return Decimal((sign, self._int, self._exp)).fix(context=context)
return Decimal( (sign, self._int, self._exp))
+
def __pos__(self, context=None):
"""Returns a copy, unless it is a sNaN.
***************
*** 786,790 ****
return ans
-
def __add__(self, other, context=None):
"""Returns self + other.
--- 787,790 ----
***************
*** 1025,1029 ****
return self._divide(other, context=context)
__truediv__ = __div__
-
def _divide(self, other, divmod = 0, context=None):
--- 1025,1028 ----
***************
*** 1359,1368 ****
prec = context.prec
ans = self.__copy__()
! ans = ans.fixexponents(prec, rounding, folddown=folddown, context=context)
if len(ans._int) > prec:
ans = ans.round(prec, rounding, context=context)
! ans = ans.fixexponents(prec, rounding, folddown=folddown, context=context)
return ans
! def fixexponents(self, prec=None, rounding=None, folddown=None, context=None):
"""Fix the exponents and return a copy with the exponent in bounds."""
if self._isinfinity():
--- 1358,1371 ----
prec = context.prec
ans = self.__copy__()
! ans = ans.fixexponents(prec, rounding, folddown=folddown,
! context=context)
if len(ans._int) > prec:
ans = ans.round(prec, rounding, context=context)
! ans = ans.fixexponents(prec, rounding, folddown=folddown,
! context=context)
return ans
!
! def fixexponents(self, prec=None, rounding=None, folddown=None,
! context=None):
"""Fix the exponents and return a copy with the exponent in bounds."""
if self._isinfinity():
***************
*** 1405,1408 ****
--- 1408,1412 ----
return context.raise_error(Overflow, 'above Emax', ans._sign)
return ans
+
def round(self, prec=None, rounding=None, context=None):
"""Returns a rounded version of self.