Decimal 0**0

Terry Reedy tjreedy at udel.edu
Thu Feb 7 09:38:01 CET 2013


On 2/7/2013 12:47 AM, Tim Roberts wrote:
> 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?

No, it follows
IBM’s General Decimal Arithmetic Specification, The General Decimal 
Arithmetic Specification.
IEEE standard 854-1987, Unofficial IEEE 854 Text.
links at end of intro in doc


-- 
Terry Jan Reedy





More information about the Python-list mailing list