[issue23201] Decimal(0)**0 is an error, 0**0 is 1, but Decimal(0) == 0

Devin Jeanpierre report at bugs.python.org
Fri Jan 9 04:37:43 CET 2015


Devin Jeanpierre added the comment:

Yes, also, it is documented: https://docs.python.org/3/library/decimal.html#decimal.InvalidOperation

Still, the status quo is bad. At the very least there should be clear documentation on how Decimal differs in behavior from floats and ints. (Other than the obvious, like 1/5 taking on a different value -- although explicitly mentioning that in the list might be a good idea.)

BTW, 0**0=1 is not mathematically impure. It at one point was fairly well accepted as the right answer, since it's the one that tends to come out naturally . e.g. http://arxiv.org/abs/math/9205211 page 6 ("ripples") . This might explain why ints and floats so casually evaluate 0**0 to 1.

----------

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


More information about the Python-bugs-list mailing list