Python cmath.isinf()วิธี การ
ตัวอย่าง
ตรวจสอบว่าค่าที่ซับซ้อนเป็นอนันต์หรือไม่:
#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))
ความหมายและการใช้งาน
วิธี การcmath.isinf()
ตรวจสอบว่าค่าเป็นบวกหรือลบอนันต์หรือไม่ เมธอดนี้คืนค่าบูลีน: True
หากค่าเป็นอนันต์ มิFalse
ฉะนั้น
ไวยากรณ์
cmath.isinf(x)
ค่าพารามิเตอร์
Parameter | Description |
---|---|
x | Required. The value to check for infinity |
รายละเอียดทางเทคนิค
คืนมูลค่า: | ค่า ถ้า bool ค่าTrue เป็นอนันต์ มิฉะนั้นFalse |
---|---|
เวอร์ชันหลาม: | 2.6 |