CKTIS / Python
math.nan
Poda posebno vrednost float, ki označuje odsotnost številskega rezultata.
Različica: Python 3.14; repository image, production runtime not attested
Sintaksa
math.nanPoda posebno vrednost float, ki označuje odsotnost številskega rezultata.
Celo primerjava math.nan s samim seboj z == da False.
Pri filtriranju meritev math.isnan za NaN da True, za neskončnost pa False.
import math
assert isinstance(math.nan, float) and math.nan != math.nan
assert math.isnan(math.nan) and not math.isinf(math.nan)
Primeri
import math
print(math.nan == math.nan)
print(math.isnan(math.nan))
Rezultat
False True
Pri filtriranju meritev math.isnan za NaN da True, za neskončnost pa False.