CKTIS / Python
math.inf
Označuje kladné nekonečno typu float.
Verzia: Python 3.14; repository image, production runtime not attested
Syntax
math.infOznačuje kladné nekonečno typu float.
Každé konečné reálne číslo, aj desať na stú, je menšie. Negácia dáva záporné nekonečno, ktoré isinf tiež rozpozná.
Porovnanie math.nan < math.inf vráti False.
import math
assert -math.inf < -(10**100) < 10**100 < math.inf
assert not (math.nan < math.inf) and math.isinf(-math.inf)
Príklady
import math
print(math.inf > 10 ** 100)
print(math.isinf(-math.inf))
Výsledok
True True
Porovnanie `math.nan < math.inf` vráti False.