Python math.isnan() Metodo
Esempio
Verifica se un valore è NaN o meno:
# Import math Library
import math
# Check whether some values are NaN
or not
print (math.isnan (56))
print
(math.isnan (-45.34))
print (math.isnan (+45.34))
print (math.isnan
(math.inf))
print (math.isnan (float("nan")))
print (math.isnan
(float("inf")))
print (math.isnan (float("-inf")))
print (math.isnan
(math.nan))
Definizione e utilizzo
Il math.isnan()
metodo controlla se un valore è NaN (Not a Number) o meno.
Questo metodo restituisce True se il valore specificato è NaN, altrimenti restituisce False.
Sintassi
math.isnan(x)
Valori dei parametri
Parameter | Description |
---|---|
x | Required. The value to check |
Dettagli tecnici
Valore di ritorno: | Un bool valore, True se il valore è NaN, altrimentiFalse |
---|---|
Versione Python: | 3.5 |