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

John Machin sjmachin at
Sat Jun 14 09:58:14 CEST 2008

On Jun 14, 3:33 pm, "John [H2O]" <washa... at> wrote:
> John Machin wrote:
> > Avoid impolite astonishment; RTFloatingM instead:
> > """
> > HTH,
> > John
> > --
> I guess the key here is that it is not an issue with Python, but C... can I
> change 'the underlying C code?'

The underlying C code for the Windows C RTL is probably on a server in
a bunker in Redmond WA ... good luck :-)

Perhaps you could start lashing up something along the lines that Dan
mentioned, e.g.

floated = {
   'NaN': 1e1000 / 1e1000,
   'Inf': whatever,

def myfloat(s):
      return float(s)
      value = floated(s)
      if value is not None:
      return value

Then when/if your mapping has enough entries to make it worthwhile,
you could maybe suggest that this be done in Numpy or in the Python


More information about the Python-list mailing list