math.isnan

Full name
math.isnan
Library
math
Syntax

math.isnan(number)

Description

The math.isnan function returns the Boolean True if the number passed as an argument is a NaN (Not a Number), or False otherwise.

Parameters
  • number: Number to evaluate. It must be an integer or real number (not a complex number).
Result

math.isnan returns a boolean.

Examples

A finite integer or real number is not interpreted as a NaN:

math.isnan(17)

False

In contrast, the result of math.nan is evaluated as a NaN:

math.isnan(math.nan)

True

The result of math.inf (the positive infinity value) is not interpreted as a NaN:

math.isnan(math.inf)

False

Submitted by admin on Tue, 01/19/2021 - 13:03