[Numpy-discussion] annoying numpy string to float conversion behaviour

Andrew Straw strawman at astraw.com
Tue Jun 26 12:56:01 EDT 2007

Torgil Svensson wrote:

> This seems to indicate that float('nan') works on some platforms but
> str(nan) isn't. Is this true on Linux? Could anyone confirm this? What
> about float('inf') and repr(inf) on Linux?

On Ubuntu Feisty (amd64) Linux (but this behavior has been the same for 
at least the 6 years I can remember.):

$ python
Python 2.5.1 (r251:54863, May  2 2007, 16:27:44)
[GCC 4.1.2 (Ubuntu 4.1.2-0ubuntu4)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
 >>> float('nan')
 >>> float('inf')
 >>> import numpy
 >>> repr(numpy.inf)
 >>> repr(numpy.nan)

More information about the NumPy-Discussion mailing list