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 a NaN result.
In programming a 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 a 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 these examples still mean the computer cannot represent a value.