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