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


Groups > comp.lang.python > #83394

Re: Decimals and other numbers

From Ben Finney <ben+python@benfinney.id.au>
Subject Re: Decimals and other numbers
Date 2015-01-09 13:43 +1100
References <CABicbJK-5izGtet8BsS1Yqx+6AHMX7gLU4zYjjt5jULJXNVipA@mail.gmail.com>
Newsgroups comp.lang.python
Message-ID <mailman.17498.1420771428.18130.python-list@python.org> (permalink)

Show all headers | View raw


Devin Jeanpierre <jeanpierreda@gmail.com> writes:

> decimal.InvalidOperation: 0 ** 0
>
> I'd file a bug report but I'm anticipating some rational (heh)
> explanation. Any ideas?

First note that it's explicitly documented as an invalid operation
<URL:file:///usr/share/doc/python3-doc/html/library/decimal.html#decimal.InvalidOperation>.
So someone has at least thought about it and deliberately decided it
should be so.

Why that should be, I don't know; I think the correct behaviour is for
‘0 ** 0 == 1’. But perhaps someone else has a better explanation for why
Decimal should behave differently from ‘int’ and ‘float’ here.

-- 
 \      “I bought a self learning record to learn Spanish. I turned it |
  `\        on and went to sleep; the record got stuck. The next day I |
_o__)                   could only stutter in Spanish.” —Steven Wright |
Ben Finney

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


Thread

Re: Decimals and other numbers Ben Finney <ben+python@benfinney.id.au> - 2015-01-09 13:43 +1100

csiph-web