Portably generating infinity and NaN

skip at pobox.com skip at pobox.com
Fri Apr 13 19:02:24 EDT 2007


    >> (Note the absence of a demonstration on Windows.)  Can't the above be
    >> blessed as the One True Way and wormed around in floatmodule.c for
    >> those platforms where float'ing "NaN" or "Inf" doesn't currently
    >> work?

    Martin> How would you do the worming-around?

I don't know.  On I was just asking.  On unixoid systems I sort of assume
you could add tests to the configure script to detect what worked.  If
converting the strings works you're done.  If not, maybe Robert Kern's numpy
code could be run in the configure script to generate constants for NaN and
Inf that could be used in floatmodule.c.  Windows would probably have to be
hard-coded, but except for 32-bit and 64-bit differences it should be the
same all over, yes?

Skip




More information about the Python-list mailing list