Hi, Is there any way to detect if a float is NaN in Python 2.4?
I can pretty much understand why float("nan") == float("nan") -> False but I then expected there to be an isnan() function, perhaps provided by the maths module. I understand a lot of the floating point behaviour is implementation-dependant, but for systems where special values such as nan, inf etc are supported, it would be nice (IMHO) for Python to support them to some degree too. Is this possible or does it get too bogged down with implementation specifics? A <nasty> solution I guess would be to do something like my_float = float("nan") If str(my_float) == "nan": doSomething() But that's awful! Any help or reasons why the functionality isn't provided would be gratefully received! Cheers, Tom
-- http://mail.python.org/mailman/listinfo/python-list