Hi all, While trying to use simplejson under Python 2.4.3 I have been investigating the handling of special floating point values and found that both Python 2.4 and 2.5 return False when comparing a NaN with itself. Although surprising, I imagine it could also be correct since NaN is not a number. But is it correct?
Notice the result of comparing c with itself in the following Python 2.5 session (it works the same on Python 2.4.3) under Win32:: Python 2.5 (r25:51908, Sep 19 2006, 09:52:17) [MSC v.1310 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> a = 1e300 * 1e300 >>> a 1.#INF >>> b = 1e66666 >>> b 1.#INF >>> a == b True >>> c = a - a >>> c -1.#IND >>> d = b - b >>> d -1.#IND >>> c == d False >>> c == c False >>> b == b True >>> a == a True >>> a is a True >>> b is b True >>> c is c True >>> d is d True >>> Thanks, -- Pierre Rouleau -- http://mail.python.org/mailman/listinfo/python-list