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

Steven D'Aprano report at bugs.python.org
Sat Jan 10 03:46:30 CET 2015


Steven D'Aprano added the comment:

Mark Dickson wrote:
> I've talked to Mike Cowlishaw (the author of the specification)
> about this particular issue, and the spec is not likely to 
> change on this point.

I'm curious about the rationale for the decision. As I'm sure you're aware, in general 0**0 is treated as 1 by both a majority (I think) of mathematicians and programming languages. As Knuth puts it, the binomial theorem is too important to do otherwise. IEEE 754 treats it as 1, although the 2008 revision adds a second power function powr() which returns NAN if both arguments are 0. So I wonder why the decimal spec choose to do otherwise?

(Not saying they're wrong to do so.)

----------
nosy: +steven.daprano

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


More information about the Python-bugs-list mailing list