CKTIS / Python
math.inf
Rappresenta l’infinito positivo di tipo float.
Versione: Python 3.14; repository image, production runtime not attested
Sintassi
math.infRappresenta l’infinito positivo di tipo float.
Qualsiasi numero reale finito, anche dieci alla centesima, è minore. La negazione dà l’infinito negativo riconosciuto da isinf.
Il confronto math.nan < math.inf dà False.
import math
assert -math.inf < -(10**100) < 10**100 < math.inf
assert not (math.nan < math.inf) and math.isinf(-math.inf)
Esempi
import math
print(math.inf > 10 ** 100)
print(math.isinf(-math.inf))
Risultato
True True
Il confronto `math.nan < math.inf` dà False.