Méthode Python cmath.isinf()
Exemple
Vérifiez si une valeur complexe est infinie ou non :
#import cmath for complex number operations
import cmath
#find
whether a complex number is infinite or not
print (cmath.isinf(complex(10
+ float('inf'))))
print (cmath.isinf(11 + 4j))
Définition et utilisation
La cmath.isinf()
méthode vérifie si une valeur est positive ou négative à l'infini, ou non. Cette méthode renvoie une valeur booléenne : True
si la valeur est l'infini, sinon False
.
Syntaxe
cmath.isinf(x)
Valeurs des paramètres
Parameter | Description |
---|---|
x | Required. The value to check for infinity |
Détails techniques
Valeur de retour : | Une bool valeur, True si la valeur est l'infini, sinonFalse |
---|---|
Version Python : | 2.6 |