Commit e42f1bb3 authored by Mark Dickinson's avatar Mark Dickinson

Fix misplaced exactness check that was causing unnecessary work in Decimal.__pow__.

parent a123631a
...@@ -2327,9 +2327,10 @@ class Decimal(object): ...@@ -2327,9 +2327,10 @@ class Decimal(object):
# try for an exact result with precision +1 # try for an exact result with precision +1
if ans is None: if ans is None:
ans = self._power_exact(other, context.prec + 1) ans = self._power_exact(other, context.prec + 1)
if ans is not None and result_sign == 1: if ans is not None:
ans = _dec_from_triple(1, ans._int, ans._exp) if result_sign == 1:
exact = True ans = _dec_from_triple(1, ans._int, ans._exp)
exact = True
# usual case: inexact result, x**y computed directly as exp(y*log(x)) # usual case: inexact result, x**y computed directly as exp(y*log(x))
if ans is None: if ans is None:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment