469,955 Members | 1,441 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,955 developers. It's quick & easy.

Re: numpy: handling float('NaN') different in XP vs. Linux

John [H2O] wrote:
I have a script:

from numpy import float
OutD=[]
v=['3','43','23.4','NaN','43']
OutD.append([float(i) for i in v[1]])
On linux:
Python 2.5.1 (r251:54863, Mar 7 2008, 04:10:12)
[GCC 4.1.3 20070929 (prerelease) (Ubuntu 4.1.2-16ubuntu2)] on linux2
[john@andLinux analysis]$ python jnk.py
[[3.0, 43.0, 23.399999999999999, nan, 43.0]]

On XP:
Python 2.5 (r25:51908, Mar 9 2007, 17:40:28) [MSC v.1310 32 bit (Intel)]
Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.

C:\analysis>C:\Python25\python.exe jnk.py
Traceback (most recent call last):
File "jnk.py", line 4, in <module>
OutD.append([float(i) for i in v])
ValueError: invalid literal for float(): NaN
I've fixed the issue for Python 2.6 and 3.0 a while ago. Mark and I have
spent a lot of time on fixing several edge cases regarding inf, nan and
numerical unsound functions in Python's math und cmath module.

Christian

Jun 27 '08 #1
0 898

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

5 posts views Thread by Andreas Beyer | last post: by
1 post views Thread by Jonathan Fong | last post: by
2 posts views Thread by Jack Russell | last post: by
22 posts views Thread by Andy McDonagh | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.