Python cmath.isinf() Metodo
Esempio
Verifica se un valore complesso è infinito o meno:
#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))
Definizione e utilizzo
Il cmath.isinf()
metodo controlla se un valore è infinito positivo o negativo o meno. Questo metodo restituisce un valore booleano: True
se il valore è infinito, altrimenti False
.
Sintassi
cmath.isinf(x)
Valori dei parametri
Parameter | Description |
---|---|
x | Required. The value to check for infinity |
Dettagli tecnici
Valore di ritorno: | Un bool valore, True se il valore è infinito, altrimentiFalse |
---|---|
Versione Python: | 2.6 |