Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #38337

Re: Decimal 0**0

From Terry Reedy <tjreedy@udel.edu>
Subject Re: Decimal 0**0
Date 2013-02-07 03:38 -0500
References <5110fa5c$0$29982$c3e8da3$5496439d@news.astraweb.com> <urf6h8hskvc5hf04d8js2n7kgv653bs976@4ax.com>
Newsgroups comp.lang.python
Message-ID <mailman.1442.1360226325.2939.python-list@python.org> (permalink)

Show all headers | View raw


On 2/7/2013 12:47 AM, Tim Roberts wrote:
> Steven D'Aprano <steve+comp.lang.python@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

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Decimal 0**0 Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-02-05 23:26 +1100
  Re: Decimal 0**0 Stefan Krah <stefan@bytereef.org> - 2013-02-05 14:05 +0100
  Re: Decimal 0**0 Tim Roberts <timr@probo.com> - 2013-02-06 21:47 -0800
    Re: Decimal 0**0 Terry Reedy <tjreedy@udel.edu> - 2013-02-07 03:38 -0500
    Re: Decimal 0**0 Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-02-08 10:31 +1100

csiph-web