Méthode Python math.isnan()
Exemple
Vérifiez si une valeur est NaN ou non :
# Import math Library
import math
# Check whether some values are NaN
or not
print (math.isnan (56))
print
(math.isnan (-45.34))
print (math.isnan (+45.34))
print (math.isnan
(math.inf))
print (math.isnan (float("nan")))
print (math.isnan
(float("inf")))
print (math.isnan (float("-inf")))
print (math.isnan
(math.nan))
Définition et utilisation
La math.isnan()
méthode vérifie si une valeur est NaN (Not a Number) ou non.
Cette méthode renvoie True si la valeur spécifiée est un NaN, sinon elle renvoie False.
Syntaxe
math.isnan(x)
Valeurs des paramètres
Parameter | Description |
---|---|
x | Required. The value to check |
Détails techniques
Valeur de retour : | Une bool valeur, True si la valeur est NaN, sinonFalse |
---|---|
Version Python : | 3.5 |