Math.isnan() determines whether float is NaN or not.
import math
x=float('nan')
math.isnan(x)
It checks whether float is NaN or not as same as math.isnan().
import numpy
x=float('nan')
numpy.isnan(x)
According to IEEE standard
, NaN value
is always false
when comparing NaN value
.
Use this to define a function.
def isNaN(num):
return num != num
x=float('nan')
isNaN(x)
© 2024 OneMinuteCode. All rights reserved.