Base de conhecimentoCentro de Exames
PT · PTPortuguês (Portugal)
Escolher idioma13

CKTIS / Python

math.inf

Representa o infinito positivo do tipo float.

Versão: Python 3.14; repository image, production runtime not attested

Sintaxe

math.inf

Representa o infinito positivo do tipo float.

Qualquer número real finito, mesmo dez elevado a cem, é menor. A negação dá o infinito negativo reconhecido por isinf.

A comparação 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)

Exemplos

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

Resultado

True
True

A comparação `math.nan < math.inf` dá False.

Fontes