Home >>Python math Module >Python math.isnan() Method
Python math.isnan() method is used to check whether the given input value is nan (Not a Number) or not. It returns a Boolean value True if the value is nan and False if the value in not.
Syntax:math.isnan(x)
Parameter | Description |
---|---|
x | This is a required parameter. It defines the value to check for NaN. |
import math
print (math.isnan (56))
print (math.isnan (-45.34))
print (math.isnan (+45.34))
print (math.isnan (math.inf))
import math
print (math.isnan (math.inf))
print (math.isnan (math.nan))
print (math.isnan (float("nan")))
print (math.isnan (float("inf")))
print (math.isnan (float("-inf")))