question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Should equal(NaN, NaN) return true?

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:13 (9 by maintainers)

github_iconTop GitHub Comments

1reaction
epoberezkincommented, Apr 17, 2018

We can prove first NaN = 1 and that second NaN = 0. If NaN == NaN then we can prove 1==0.

This proof has (or would have) an obvious logical flaw, like all sophisms, discussing which is out of scope here.

I think the right approach is just do what most other libraries do (still need to check it).

1reaction
Ygg01commented, Feb 23, 2018

No. NaN means value you get is indeterminate.

Take for example following expression x*1/x. It’s obvious this value is 1 whatever x is, however look what happens when x approaches really small value (e.g. 1e-324*(1/1e-324)) the value becomes NaN.

Another example could be 0*x. The value is obviously 0 for any x != 0 so when e.g. x is 1e+324*(1/1e+324) it becomes NaN as well.

We can prove first NaN = 1 and that second NaN = 0. If NaN == NaN then we can prove 1==0.

Read more comments on GitHub >

github_iconTop Results From Across the Web

NaN - Wikipedia
In computing, NaN standing for Not a Number, is a member of a numeric data type that can be interpreted as a value...
Read more >
NaN - JavaScript - MDN Web Docs
NaN is a property of the global object. In other words, it is a variable in global scope. In modern browsers, NaN is...
Read more >
National Action Network
NAN has been marching and fighting for civil rights since 1991. Watch previous speeches from political leaders like Barack Obama, Joe Biden &...
Read more >
Nan Definition & Meaning - Merriam-Webster
The meaning of NAN is a round flat leavened bread especially of the Indian subcontinent.
Read more >
nan - Wiktionary
From Nan, pet form of the formerly very common female given names Anne and Agnes. As a nursemaid and grandmother, a clipping of...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found