]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Merged revisions 75275 via svnmerge from
authorMark Dickinson <dickinsm@gmail.com>
Tue, 27 Oct 2009 16:54:45 +0000 (16:54 +0000)
committerMark Dickinson <dickinsm@gmail.com>
Tue, 27 Oct 2009 16:54:45 +0000 (16:54 +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 43244308c0a7248f3e16f9d55e3c741829f70834..d589fd779f9744dcc532114f1227d835f61b4826 100644 (file)
@@ -3083,7 +3083,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 53d172113b9cd8d33e82abbaa14d2331c6b3b3e6..a1a53a7223dccd441fb1b43d0cfa8841a14859c3 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -22,6 +22,9 @@ Core and Builtins
 Library
 -------
 
+- Issue #7048: Force Decimal.logb to round its result when that result
+  is too large to fit in the current precision.
+
 Tests
 -----