math.isinf

Full name
math.isinf
Library
math
Syntax

math.isinf(number)

Description

The math.isinf function returns the Boolean True if the number passed as an argument is infinite (either positive or negative), or False otherwise.

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

The math.isinf function returns a Boolean.

Examples

The value represented by math.inf is, of course, infinite:

math.isinf(math.inf)

True

And so is -math.inf:

math.isinf(-math.inf)

True

The value represented by math.nan, however, is not considered infinite:

math.isinf(math.nan)

False

A finite real or integer value is logically not infinite:

math.isinf(18)

False

math.isinf(18.1)

False

Submitted by admin on Tue, 01/19/2021 - 11:29