Método Python math.isnan()
Exemplo
Verifique se um valor é NaN ou não:
# 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))
Definição e uso
O math.isnan()
método verifica se um valor é NaN (Not a Number) ou não.
Este método retorna True se o valor especificado for um NaN, caso contrário, retorna False.
Sintaxe
math.isnan(x)
Valores de parâmetro
Parameter | Description |
---|---|
x | Required. The value to check |
Detalhes técnicos
Valor de retorno: | Um bool valor, True se o valor for NaN, caso contrárioFalse |
---|---|
Versão do Python: | 3,5 |