DEV Community

Discussion on: What is the type of NaN?

clarity89 profile image
Alex K. Author • Edited on

Haha, well it's more like each NaN has a different value under the hood, so technically they're not equal to each other.

Fun fact: since most of the bits in NaN encoding aren't used to store any meaningful information, they can be manipulated to store actual data - payload. This is called NaN-tagging or NaN-boxing and is mostly used for adding additional type encodings to values. Here's one interesting article about it.

Thread Thread
vicoerv profile image

wow thank you, never thought about that