Short for Not a Number, in mathematics and computer programming NaN is an undefined or unrepresentable value, especially in floating-point calculations. For example, 0/0 or the square root of a negative number would return an NaN result.
In programming an NaN can also occur if your variables or another input contains any character that is not a number or period. For example, trying to do a calculation on a variable with letters or commas causes an NaN error.
NaN example output
Depending on the operating system, programming language, or program NaN can also appear as any of the examples below. All of these examples still mean the computer cannot represent a value.