CKTIS / Python
math.inf
Označuje kladné nekonečno typu float.
Verze: Python 3.14; repository image, production runtime not attested
Syntaxe
math.infOznačuje kladné nekonečno typu float.
Každé konečné reálné číslo, i deset na stou, je menší. Negace dává záporné nekonečno, které isinf také rozpozná.
Porovnání math.nan < math.inf vrací False.
import math
assert -math.inf < -(10**100) < 10**100 < math.inf
assert not (math.nan < math.inf) and math.isinf(-math.inf)
Příklady
import math
print(math.inf > 10 ** 100)
print(math.isinf(-math.inf))
Výsledek
True True
Porovnání `math.nan < math.inf` vrací False.