Python/ref cmath isinf
来自菜鸟教程
<languages />
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))
定义和用法
The
cmath.isinf()
方法检查值是正无穷还是负无穷大。此方法返回一个布尔值:
True
如果值是无穷大,否则
False
.
句法
cmath.isinf(x)
参数值
| 参数 | 描述 |
|---|---|
| x | 需要。检查无穷大的值 |
技术细节
| 返回值: | A
|
| Python版本: | 2.6 |