Python cmath.isfinite() Methode
Beispiel
Prüfen Sie, ob ein komplexer Wert endlich ist oder nicht:
#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))
Definition und Verwendung
Die cmath.isfinite()
Methode prüft, ob ein komplexer Wert endlich ist oder nicht. Diese Methode gibt einen booleschen Wert zurück: True
wenn der Wert endlich ist, andernfalls False
.
Syntax
cmath.isfinite(x)
Parameterwerte
Parameter | Description |
---|---|
x | Required. The value to check if it is finite or not |
Technische Details
Rückgabewert: | Ein bool Wert, True wenn der Wert endlich ist, sonstFalse |
---|---|
Python-Version: | 3.2 |