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


Groups > comp.lang.python > #83394

Re: Decimals and other numbers

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed4.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <python-python-list@m.gmane.org>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.005
X-Spam-Evidence '*H*': 0.99; '*S*': 0.00; 'explicitly': 0.05; 'differently': 0.07; 'explanation': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'bug': 0.12; 'behave': 0.16; 'finney': 0.16; 'know;': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'sleep;': 0.16; 'so.': 0.16; 'header:User-Agent:1': 0.23; 'documented': 0.24; 'least': 0.26; 'header:X-Complaints-To:1': 0.27; 'record': 0.27; 'correct': 0.29; "i'm": 0.30; 'went': 0.31; 'decimal': 0.31; 'subject:numbers': 0.31; 'subject:other': 0.31; 'wright': 0.31; 'writes:': 0.31; 'file': 0.32; 'skip:d 20': 0.34; "i'd": 0.34; 'could': 0.34; 'but': 0.35; 'bought': 0.36; 'next': 0.36; 'should': 0.36; 'ben': 0.38; 'to:addr:python-list': 0.38; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'first': 0.61; 'decided': 0.64; 'invalid': 0.68; 'day': 0.76; 'received:125': 0.84; 'spanish.': 0.84
X-Injected-Via-Gmane http://gmane.org/
To python-list@python.org
From Ben Finney <ben+python@benfinney.id.au>
Subject Re: Decimals and other numbers
Date Fri, 09 Jan 2015 13:43:04 +1100
References <CABicbJK-5izGtet8BsS1Yqx+6AHMX7gLU4zYjjt5jULJXNVipA@mail.gmail.com>
Mime-Version 1.0
Content-Type text/plain; charset=utf-8
Content-Transfer-Encoding 8bit
X-Gmane-NNTP-Posting-Host jigong.madmonks.org
X-Public-Key-ID 0xAC128405
X-Public-Key-Fingerprint 517C F14B B2F3 98B0 CB35 4855 B8B2 4C06 AC12 8405
X-Public-Key-URL http://www.benfinney.id.au/contact/bfinney-pubkey.asc
X-Post-From Ben Finney <bignose+hates-spam@benfinney.id.au>
User-Agent Gnus/5.13 (Gnus v5.13) Emacs/24.4 (gnu/linux)
Cancel-Lock sha1:VO8ijhTBC//W68SE+Bk5TX/RWbg=
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.17498.1420771428.18130.python-list@python.org> (permalink)
Lines 22
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1420771428 news.xs4all.nl 2911 [2001:888:2000:d::a6]:42937
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:83394

Show key headers only | 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