Méthode Python cmath.isnan()
Exemple
Vérifiez si une valeur complexe est NaN ou non :
#import cmath for complex number operations
import cmath
#find
whether a complex number is NaN or not
print (cmath.isnan(12 +
float('nan')))
print (cmath.isnan(2 + 3j))
Définition et utilisation
La cmath.isnan()
méthode vérifie si une valeur est nan (pas un nombre) ou non. Cette méthode renvoie une valeur booléenne : True
si la valeur est nan, sinonFalse
Syntaxe
cmath.isnan(x)
Valeurs des paramètres
Parameter | Description |
---|---|
x | Required. The value to check for NaN |
Détails techniques
Valeur de retour : | Une bool valeur, True si une partie (réelle ou imaginaire) d'un nombre complexe est NaN, sinonFalse |
---|---|
Version Python : | 2.6 |