Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #83395
| Path | csiph.com!usenet.pasdenom.info!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed3a.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <davea@davea.name> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.010 |
| X-Spam-Evidence | '*H*': 0.98; '*S*': 0.00; 'exception,': 0.09; 'expected.': 0.09; 'raises': 0.09; 'undefined': 0.09; 'python': 0.11; 'bug': 0.12; 'informative.': 0.16; 'nan': 0.16; 'exception': 0.16; 'wrote:': 0.18; 'result.': 0.19; "skip:' 30": 0.19; 'import': 0.22; 'header:User-Agent:1': 0.23; 'error': 0.23; 'skip:" 30': 0.26; 'header:In-Reply-To:1': 0.27; 'raise': 0.29; 'skip:( 20': 0.30; "i'm": 0.30; '"",': 0.31; '>>>>': 0.31; 'decimal': 0.31; 'subject:numbers': 0.31; 'subject:other': 0.31; 'file': 0.32; 'skip:c 30': 0.32; '(most': 0.33; 'noticed': 0.34; 'skip:d 20': 0.34; "i'd": 0.34; 'but': 0.35; 'to:addr:python- list': 0.38; 'pm,': 0.38; 'recent': 0.39; 'expect': 0.39; 'to:addr:python.org': 0.39; 'either': 0.39; 'received:74.208': 0.68; 'behavior': 0.77; '3.4': 0.84 |
| Date | Thu, 08 Jan 2015 21:43:40 -0500 |
| From | Dave Angel <davea@davea.name> |
| User-Agent | Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.4.0 |
| MIME-Version | 1.0 |
| To | python-list@python.org |
| Subject | Re: Decimals and other numbers |
| References | <CABicbJK-5izGtet8BsS1Yqx+6AHMX7gLU4zYjjt5jULJXNVipA@mail.gmail.com> |
| In-Reply-To | <CABicbJK-5izGtet8BsS1Yqx+6AHMX7gLU4zYjjt5jULJXNVipA@mail.gmail.com> |
| Content-Type | text/plain; charset=ISO-8859-1; format=flowed |
| Content-Transfer-Encoding | 7bit |
| X-Provags-ID | V02:K0:y7fxKAv9tCRmlxU6Soko/61cXcKUlPgFrGMFKYqItQt m6iDS95dNqDuM5SKFjdeOXiyQjnRD3zJdJhxVRk4BSkR3T+sIC epKNyqFOvC2G3H1NagOTq+GcIdnOq4IO1hEhuU9whVObH6whvq J3c8LZA6JIKfKfY/wEpNHrO9QueRJ7CQ5SXLED9rN3h/HrpCUv EKNXJvmF03zQVW5mZeM/H99dmYu+XbLgQtDq6bGWOkEBsOgoGC t6JZEDv0p0Sh4iH3xo9Htzh3baJcRJmhGrCypPfH89bxAGpssq r7QpnG9lcL1Cxnk2V+I/vmSNwipyQSepu98BETyNAkH7eeCaCV ryRhgA7XPl8Bvwwf08Jk= |
| X-UI-Out-Filterresults | notjunk:1; |
| 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.17499.1420771441.18130.python-list@python.org> (permalink) |
| Lines | 37 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1420771441 news.xs4all.nl 2917 [2001:888:2000:d::a6]:43198 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:83395 |
Show key headers only | View raw
On 01/08/2015 09:33 PM, Devin Jeanpierre wrote:
> I noticed some very PHP-ish behavior today:
>
>>>> import decimal
>>>> x = 0
>>>> y = float(x)
>>>> z = decimal.Decimal(x)
>>>> x == y == z == x
> True
>>>> x ** x
> 1
>>>> y**y
> 1.0
>>>> z**z
> Traceback (most recent call last):
> File "<stdin>", line 1, in <module>
> File "/usr/lib/python2.7/decimal.py", line 2216, in __pow__
> return context._raise_error(InvalidOperation, '0 ** 0')
> File "/usr/lib/python2.7/decimal.py", line 3872, in _raise_error
> raise error(explanation)
> decimal.InvalidOperation: 0 ** 0
>
>
> I'd file a bug report but I'm anticipating some rational (heh)
> explanation. Any ideas?
>
> Python 3.4 also raises this exception, but the error message is less
> informative. ("decimal.InvalidOperation: [<class
> 'decimal.InvalidOperation'>]").
What you don't say is which behavior you actually expected. Since 0**0
is undefined mathematically, I'd expect either an exception or a NAN result.
--
DaveA
Back to comp.lang.python | Previous | Next — Next in thread | Find similar | Unroll thread
Re: Decimals and other numbers Dave Angel <davea@davea.name> - 2015-01-08 21:43 -0500 Re: Decimals and other numbers Marko Rauhamaa <marko@pacujo.net> - 2015-01-09 08:45 +0200
csiph-web