Python cmath.isfinite() Metodo
Esempio
Verifica se un valore complesso è finito o meno:
#import cmath for complex number operations
import cmath
#find
whether a complex number is finite or not
print (cmath.isfinite(2 + 3j))
print (cmath.isfinite(complex(5.0,float('inf'))))
print
(cmath.isfinite(float('inf')+ 5j))
Definizione e utilizzo
Il cmath.isfinite()
metodo controlla se un valore complesso è finito o meno. Questo metodo restituisce un valore booleano: True
se il valore è finito, altrimenti False
.
Sintassi
cmath.isfinite(x)
Valori dei parametri
Parameter | Description |
---|---|
x | Required. The value to check if it is finite or not |
Dettagli tecnici
Valore di ritorno: | Un bool valore, True se il valore è finito, altrimentiFalse |
---|---|
Versione Python: | 3.2 |