[PyPy-issue] [issue618] NaN and Inf support in complex
Andrew Dalke
pypy-dev-issue at codespeak.net
Mon Jan 3 02:40:45 CET 2011
New submission from Andrew Dalke <dalke at dalkescientific.com>:
Support for complex("nan") in CPython took a while to get working. Here is some of the discussion
http://bugs.python.org/issue2121 .
In CPython 2.7 complex does take NaN and Inf values
Python 2.7 (trunk:74969:87651M, Jan 2 2011, 21:58:12)
[GCC 4.2.1 (Apple Inc. build 5664)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> complex("nan")
(nan+0j)
>>> complex("nan-nanj")
(nan+nanj)
>>> complex("inf")
(inf+0j)
>>>
This was not the case with CPython 2.6 (2.5 gives the same errors)
Python 2.6.1 (r261:67515, Jun 24 2010, 21:47:49)
[GCC 4.2.1 (Apple Inc. build 5646)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> complex("nan")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ValueError: complex() arg is a malformed string
>>> complex("inf")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ValueError: complex() arg is a malformed string
>>>
PyPy has different reactions then either of the above, and the "nannanj" is definitely wrong.
Python 2.5.2 (e503e483e9ac, Dec 21 2010, 11:52:14)
[PyPy 1.4.1] on darwin
Type "help", "copyright", "credits" or "license" for more information.
And now for something completely different: ``it's Sunday, maybe''
>>>> complex("nan")
(nan+0j)
>>>> complex("nan-nanj")
(nannanj)
>>>> complex("inf")
Traceback (most recent call last):
File "<console>", line 1, in <module>
ValueError: complex() literal too large to convert
>>>>
----------
effort: easy
messages: 2044
nosy: dalke, pypy-issue
priority: bug
release: 1.4
status: unread
title: NaN and Inf support in complex
_______________________________________________________
PyPy development tracker <pypy-dev-issue at codespeak.net>
<https://codespeak.net/issue/pypy-dev/issue618>
_______________________________________________________
More information about the Pypy-issue
mailing list