Decimals and other numbers

Marko Rauhamaa marko at
Fri Jan 9 07:45:04 CET 2015

Dave Angel <davea at>:

> What you don't say is which behavior you actually expected. Since 0**0
> is undefined mathematically, I'd expect either an exception or a NAN
> result.

IEEE 754 mandates that 0**0 should evaluate to 1:


    The standard pow function and the integer exponent pown function
    define 0**0, 1**∞, and ∞**0 as 1.

    The powr function defines all three indeterminate forms as invalid
    operations and so returns NaN.

Should IEEE 754's anomalies spill over to decimal, is a different


More information about the Python-list mailing list