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

Andrew Straw strawman@astraw....
Tue Jun 26 11:56:01 CDT 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')
nan
 >>> float('inf')
inf
 >>> import numpy
 >>> repr(numpy.inf)
'inf'
 >>> repr(numpy.nan)
'nan'


More information about the Numpy-discussion mailing list