[Python-checkins] r75275 - in python/trunk: Lib/decimal.py Misc/NEWS

mark.dickinson python-checkins at python.org
Wed Oct 7 21:22:05 CEST 2009


Author: mark.dickinson
Date: Wed Oct  7 21:22:05 2009
New Revision: 75275

Log:
Issue #7048: logb should round its result when that result doesn't fit
into the available precision.  (Tests for this change are included in
the most recent set of testcases from the Decimal Specification site;
those testcases will be updated shortly.)



Modified:
   python/trunk/Lib/decimal.py
   python/trunk/Misc/NEWS

Modified: python/trunk/Lib/decimal.py
==============================================================================
--- python/trunk/Lib/decimal.py	(original)
+++ python/trunk/Lib/decimal.py	Wed Oct  7 21:22:05 2009
@@ -3126,7 +3126,8 @@
         # otherwise, simply return the adjusted exponent of self, as a
         # Decimal.  Note that no attempt is made to fit the result
         # into the current context.
-        return Decimal(self.adjusted())
+        ans = Decimal(self.adjusted())
+        return ans._fix(context)
 
     def _islogical(self):
         """Return True if self is a logical operand.

Modified: python/trunk/Misc/NEWS
==============================================================================
--- python/trunk/Misc/NEWS	(original)
+++ python/trunk/Misc/NEWS	Wed Oct  7 21:22:05 2009
@@ -398,6 +398,9 @@
 Library
 -------
 
+- Issue #7048: Force Decimal.logb to round its result when that result
+  is too large to fit in the current precision.
+
 - Issue #6516: Added owner/group support when creating tar archives in 
   Distutils.
 


More information about the Python-checkins mailing list