Base de connaissancesCentre d’examen
FRFrançais
Choisir la langue13

CKTIS / Python

math.inf

Représente l’infini positif de type float.

Version : Python 3.14; repository image, production runtime not attested

Syntaxe

math.inf

Représente l’infini positif de type float.

Tout réel fini, même dix puissance cent, lui est inférieur. La négation donne l’infini négatif reconnu par isinf.

La comparaison math.nan < math.inf donne False.

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

Exemples

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

Résultat

True
True

La comparaison `math.nan < math.inf` donne False.

Sources