Base de conocimientosCentro de exámenes
ESEspañol
Elegir idioma13

CKTIS / Python

math.inf

Representa el infinito positivo de tipo float.

Versión: Python 3.14; repository image, production runtime not attested

Sintaxis

math.inf

Representa el infinito positivo de tipo float.

Todo número real finito, incluso diez elevado a cien, es menor. La negación da el infinito negativo reconocido por isinf.

La comparación math.nan < math.inf da False.

import math
assert -math.inf < -(10**100) < 10**100 < math.inf
assert not (math.nan < math.inf) and math.isinf(-math.inf)

Ejemplos

import math
print(math.inf > 10 ** 100)
print(math.isinf(-math.inf))

Resultado

True
True

La comparación `math.nan < math.inf` da False.

Fuentes