NaN

Updated: 11/13/2018 by Computer Hope
not a number

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.

  • -1.#IND
  • 1.#SNAN
  • 1.#QNAN
  • nan
  • NAN
  • NaN%
  • NaNQ
  • NaNS
  • NotANumber
  • qNaN
  • sNaN

Computer acronyms, Negative number, Operating system, Programming language, Programming terms, Undefined