Decimals and other numbers

Marko Rauhamaa marko at pacujo.net
Fri Jan 9 01:45:04 EST 2015


Dave Angel <davea at davea.name>:
> 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:
 <URL: http://en.wikipedia.org/wiki/NaN#Operations_generating_NaN>
 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
question.
Marko


More information about the Python-list mailing list

AltStyle によって変換されたページ (->オリジナル) /