Asked • 03/26/19

Why is NaN not equal to NaN?

The relevant IEEE standard defines a numeric constant NaN (not a number) and prescribes that NaN should compare as not equal to itself. Why is that? All the languages I'm familiar with implement this rule. I am sure there is a good reason why NaN comparing as equal to itself would be bad. I just can't figure out what it is.

1 Expert Answer

By:

Ian M. answered • 03/26/19

Tutor
5.0 (2,509)

Web Development Specialist, Expert JavaScript Programmer

Still looking for help? Get the right answer, fast.

Ask a question for free

Get a free answer to a quick problem.
Most questions answered within 4 hours.

OR

Find an Online Tutor Now

Choose an expert and meet online. No packages or subscriptions, pay only for the time you need.