[Python-checkins] r57623 - in python/branches/decimal-branch/Lib: decimal.py test/decimaltestdata/extra.decTest
facundo.batista
python-checkins at python.org
Tue Aug 28 22:55:44 CEST 2007
Author: facundo.batista
Date: Tue Aug 28 22:55:43 2007
New Revision: 57623
Modified:
python/branches/decimal-branch/Lib/decimal.py
python/branches/decimal-branch/Lib/test/decimaltestdata/extra.decTest
Log:
scaleb should call _fix instead of _fixexponents at the end. This
makes a difference when the first argument has precision greater
than the context precision. Thanks Mark Dickinson.
Modified: python/branches/decimal-branch/Lib/decimal.py
==============================================================================
--- python/branches/decimal-branch/Lib/decimal.py (original)
+++ python/branches/decimal-branch/Lib/decimal.py Tue Aug 28 22:55:43 2007
@@ -3492,7 +3492,7 @@
return self
d = Decimal((self._sign, self._int, self._exp + int(other)))
- d = d._fixexponents(context)
+ d = d._fix(context)
return d
def shift(self, other, context=None):
Modified: python/branches/decimal-branch/Lib/test/decimaltestdata/extra.decTest
==============================================================================
--- python/branches/decimal-branch/Lib/test/decimaltestdata/extra.decTest (original)
+++ python/branches/decimal-branch/Lib/test/decimaltestdata/extra.decTest Tue Aug 28 22:55:43 2007
@@ -135,6 +135,18 @@
extr1100 add 0E+1000 1E+1000 -> Infinity Overflow Inexact Rounded
extr1101 remainder 1E+1000 2E+1000 -> Infinity Overflow Inexact Rounded
+-- tests for scaleb in case where input precision > context precision.
+-- Result should be rounded. (This isn't totally clear from the
+-- specification, but the treatment of underflow in the testcases
+-- suggests that rounding should occur in general. Furthermore, it's
+-- the way that the reference implementation behaves.)
+maxexponent: 999
+minexponent: -999
+precision: 3
+extr1200 scaleb 1234 1 -> 1.23E+4 Inexact Rounded
+extr1201 scaleb 5678 0 -> 5.68E+3 Inexact Rounded
+extr1202 scaleb -9105 -1 -> -910 Inexact Rounded
+
------------------------------------------------------------------------
-- The following tests (pwmx0 through pwmx440) are for the --
-- three-argument version of power: --
More information about the Python-checkins
mailing list