Python cmath.isinf() Metode
Contoh
Periksa apakah nilai kompleks tidak terbatas atau tidak:
#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))
Definisi dan Penggunaan
Metode cmath.isinf()
ini memeriksa apakah suatu nilai positif atau negatif tak terhingga, atau tidak. Metode ini mengembalikan nilai Boolean: True
jika nilainya tak terhingga, jika tidak False
.
Sintaksis
cmath.isinf(x)
Nilai Parameter
Parameter | Description |
---|---|
x | Required. The value to check for infinity |
Detail Teknis
Nilai Kembali: | Sebuah bool nilai, True jika nilainya tak terhingga, sebaliknyaFalse |
---|---|
Versi Python: | 2.6 |