math.isfinite

Full name
math.isfinite
Library
math
Syntax

math.isfinite(number)

Description

The math.isfinite function returns the value True if the number passed as an argument is neither infinity nor NaN.

Parameters
  • number: Number to evaluate
Result

The result returned by the math.isfinite function is a Boolean.

Examples

The number 18 is finite:

math.isfinite(18)

True

...as the number 0:

math.isfinite(0)

True

...or a negative number:

math.isfinite(-18.16)

True

However, the result returned by math.inf (equivalent to infinity) is not finite:

math.isfinite(math.inf)

False

...nor is the result returned by math.nan :

math.isfinite(math.nan)

False

Submitted by admin on Thu, 01/21/2021 - 20:03