[Python-Dev] Why is nan != nan? (original) (raw)

Curt Hagenlocher curt at hagenlocher.org
Thu Mar 25 15:19:24 CET 2010


On Thu, Mar 25, 2010 at 7:08 AM, Nick Coghlan <ncoghlan at gmail.com> wrote:

Jesus Cea wrote: > But IEEE 754 was created by pretty clever guys and sure they had a > reason for define things in the way they are. Probably we are missing > something.

Yes, this is where their "implementable in a hardware circuit" focus comes in. They were primarily thinking of a floating point representation where the 32/64 bits are it - you can't have "multiple NaNs" because you don't have the bits available to describe them. Wait, what? I haven't been paying much attention, but this is backwards. There are multiple representations of NaN in the IEEE encoding; that's actually part of the problem with saying that NaN = NaN or NaN != NaN. If you want to ignore the "payload" in the NaN, then you're not just comparing bits any more.

-- Curt Hagenlocher curt at hagenlocher.org -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://mail.python.org/pipermail/python-dev/attachments/20100325/12b03b63/attachment.html>



More information about the Python-Dev mailing list