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


Groups > comp.lang.python > #38332

Re: Decimal 0**0

From Tim Roberts <timr@probo.com>
Newsgroups comp.lang.python
Subject Re: Decimal 0**0
Date 2013-02-06 21:47 -0800
Organization Providenza & Boekelheide, Inc.
Message-ID <urf6h8hskvc5hf04d8js2n7kgv653bs976@4ax.com> (permalink)
References <5110fa5c$0$29982$c3e8da3$5496439d@news.astraweb.com>

Show all headers | View raw


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?
-- 
Tim Roberts, timr@probo.com
Providenza & Boekelheide, Inc.

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