diff options
author | Mark Dickinson <dickinsm@gmail.com> | 2010-07-08 19:09:16 (GMT) |
---|---|---|
committer | Mark Dickinson <dickinsm@gmail.com> | 2010-07-08 19:09:16 (GMT) |
commit | e42f1bb3548f322bc0fd4a5db4cff26be901a034 (patch) | |
tree | b397dbf6dee7c84c5795095492ec65b5c0382f83 /Lib/decimal.py | |
parent | a123631a5ca464c99faf039ee5c74ec9025d5d64 (diff) | |
download | cpython-e42f1bb3548f322bc0fd4a5db4cff26be901a034.zip cpython-e42f1bb3548f322bc0fd4a5db4cff26be901a034.tar.gz cpython-e42f1bb3548f322bc0fd4a5db4cff26be901a034.tar.bz2 |
Fix misplaced exactness check that was causing unnecessary work in Decimal.__pow__.
Diffstat (limited to 'Lib/decimal.py')
-rw-r--r-- | Lib/decimal.py | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/Lib/decimal.py b/Lib/decimal.py index 71408a8..5cb5ea9 100644 --- a/Lib/decimal.py +++ b/Lib/decimal.py @@ -2327,9 +2327,10 @@ class Decimal(object): # try for an exact result with precision +1 if ans is None: ans = self._power_exact(other, context.prec + 1) - if ans is not None and result_sign == 1: - ans = _dec_from_triple(1, ans._int, ans._exp) - exact = True + if ans is not None: + if result_sign == 1: + ans = _dec_from_triple(1, ans._int, ans._exp) + exact = True # usual case: inexact result, x**y computed directly as exp(y*log(x)) if ans is None: |