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 |
---|---|
Pythonバージョン: | 2.62.6 |