Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 56df887

Browse files
committed
Merged revisions 75275 via svnmerge from
svn+ssh://[email protected]/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.) ........
1 parent 7d52079 commit 56df887

2 files changed

Lines changed: 5 additions & 1 deletion

File tree

Lib/decimal.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3209,7 +3209,8 @@ def logb(self, context=None):
32093209
# otherwise, simply return the adjusted exponent of self, as a
32103210
# Decimal. Note that no attempt is made to fit the result
32113211
# into the current context.
3212-
return Decimal(self.adjusted())
3212+
ans = Decimal(self.adjusted())
3213+
return ans._fix(context)
32133214

32143215
def _islogical(self):
32153216
"""Return True if self is a logical operand.

Misc/NEWS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,9 @@ C-API
8787
Library
8888
-------
8989

90+
- Issue #7048: Force Decimal.logb to round its result when that result
91+
is too large to fit in the current precision.
92+
9093
- Issue #6236, #6348: Fix various failures in the I/O library under AIX
9194
and other platforms, when using a non-gcc compiler. Patch by egreen.
9295

0 commit comments

Comments
 (0)