]> granicus.if.org Git - python/commitdiff
Merged revisions 75275 via svnmerge from
authorMark Dickinson <dickinsm@gmail.com>
Wed, 7 Oct 2009 19:23:50 +0000 (19:23 +0000)
committerMark Dickinson <dickinsm@gmail.com>
Wed, 7 Oct 2009 19:23:50 +0000 (19:23 +0000)
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r75275 | mark.dickinson | 2009-10-07 20:22:05 +0100 (Wed, 07 Oct 2009) | 6 lines

  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.)
........

Lib/decimal.py
Misc/NEWS

index 33f539178be8b3ea46130d14059c5076a1c6d534..5045722f5b17b0ec02a34f7e608be5b0d42cc6e4 100644 (file)
@@ -3209,7 +3209,8 @@ class Decimal(object):
         # 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.
index 3937389a49377b34d49469f4c695b1535c52b0f8..42c7454bf59dadd69dea28e9ff557ec36db79e9a 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -87,6 +87,9 @@ C-API
 Library
 -------
 
+- Issue #7048: Force Decimal.logb to round its result when that result
+  is too large to fit in the current precision.
+
 - Issue #6236, #6348: Fix various failures in the I/O library under AIX
   and other platforms, when using a non-gcc compiler. Patch by egreen.