[Python-Dev] Why is nan != nan?

Guido van Rossum guido at python.org
Fri Mar 26 00:14:30 CET 2010

On Thu, Mar 25, 2010 at 12:31 PM, Glenn Linderman <v+python at g.nevcal.com> wrote:
> It is my understand that even bit-for-bit identical NaN values will compare
> unequal according to IEEE 754 rules.
> I would have no problem with Python interning each encountered NaN value, to
> avoid having bit-for-bit identical NaN values with different Python IDs, but
> having them compare equal seems inappropriate.

Let's please not intern NaNs. Interning is for performance. If you
have enough NaNs to affect your performance I think you have bigger

--Guido van Rossum (python.org/~guido)

More information about the Python-Dev mailing list