Decimal 0**0

Tim Roberts timr at probo.com
Thu Feb 7 00:47:14 EST 2013


Steven D'Aprano <steve+comp.lang.python at pearwood.info> wrote:
>
>Does anyone have an explanation why Decimal 0**0 behaves so differently from
>float 0**0?
>...
>I am familiar with the arguments for treating 0**0 as 0, or undefined, but
>thought that except for specialist use-cases, it was standard practice for
>programming languages to have 0**0 return 1. According to Wikipedia, the
>IEEE 754 standard is for "pow" to return 1, although languages can define a
>separate "powr" function to return a NAN.
>
>http://en.wikipedia.org/wiki/Exponentiation#Zero_to_the_power_of_zero
>
>I suspect this is a bug in Decimal's interpretation of the standard. Can
>anyone comment?

I don't think Decimal ever promised to adhere to IEEE 754, did it?
-- 
Tim Roberts, timr at probo.com
Providenza & Boekelheide, Inc.



More information about the Python-list mailing list