[Python] inf represents positive infinity

Use float ('inf') or math.inf. (Math.inf is from Python 3.5)

Try to run

>>> float('inf')
inf

>>> import math
>>> math.inf
inf

>>> float('inf') == math.inf
True

>>> math.inf > 10 ** 10
True
>>> math.inf < 10 ** 10
False

document

https://docs.python.org/ja/3/library/math.html#math.inf

Recommended Posts

[Python] inf represents positive infinity
Python: Negative / Positive Analysis: Text Analysis Application