**NaN is** a term used in mathematics and computer science to describe a non-numeric value.

The full-form of NaN is ” **Not a Number** .” It can also be used on the basis of a placeholder for an expected numeric result that cannot be defined on the basis of a floating-point number.

There are two primary types of methods by which NaN can be generated:

1) एक mathematical calculation

2) non-numeric input.

Here the following mathematical calculations provide results that are undefined:

- 0 ÷ 0
- 0 x ∞
- ∞ ÷ ∞

When a calculation includes a character, string, or another non-numeric value, the result can also contain NaN. For example, 20 x ” **horse** ” does not provide any numeric result since 20 is an integer and “horse” is a string. A function can return NaN that too invalid input as a result, which is preferred for a program crash over alternative.

Some spreadsheet and database programs display NaN or #NaN in a table cell when the cell formula does not receive a valid numeric input for calculation.

Different programming languages handle NaN values in different ways. For example, in JavaScript , NaN is a property of global object (ie Number.NaN). At the same time JavaScript provides an isNan () function to check whether a value is NaN or not. PHP uses the function is_nan () for the same function. Both return a boolean value which is true or false.