Pythonmath.inf定数_
例
正と負の無限大を出力します。
# Import math Library
import math
# Print the positive infinity
print (math.inf)
# Print the negative infinity
print (-math.inf)
定義と使用法
math.inf
定数は、浮動小数点の正の無限大を返します。
負の無限大の場合は、を使用します-math.inf
。
inf定数は。と同等float('inf')
です。
構文
math.inf
技術的な詳細
戻り値: | 正の無限大のfloat 値を表す値 |
---|---|
Pythonバージョン: | 3.5 |