[issue12080] decimal.py: performance in _power_exact

Stefan Krah report at bugs.python.org
Sun May 15 10:28:22 CEST 2011


New submission from Stefan Krah <stefan-usenet at bytereef.org>:

I found another performance issue in _power_exact:

>>> Decimal(4) ** Decimal("-1.2e-999999999")
^CTraceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/stefan/pydev/cpython/Lib/decimal.py", line 2343, in __pow__
    ans = self._power_exact(other, context.prec + 1)
  File "/home/stefan/pydev/cpython/Lib/decimal.py", line 2098, in _power_exact
    ten_pow = 10**-ye
KeyboardInterrupt



This one is in the power operation in line 2098. There are several
other places where huge integer powers are calculated if 'ye' is
sufficiently large.

----------
components: Library (Lib)
messages: 136022
nosy: mark.dickinson, skrah
priority: normal
severity: normal
status: open
title: decimal.py: performance in _power_exact
type: performance
versions: Python 3.3, Python 3.4

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue12080>
_______________________________________


More information about the Python-bugs-list mailing list