Value NaN of a variable

Lets assume you are talking about a float. In Java a float is stored in 4 bytes of memory that’s 32 bits, since each bit can be 0 or 1 that gives us 4294967296 different combinations to encode a floating point number. Not all those combinations represent a valid floating point number hence Not a Number or NaN

3 Likes