Constante math.nan de Python

Python math 模块Módulo math de Python

Python math.nanDevuelve un valor flotante nan (not a number, no es un número), este valor no es un número válido.

math.nanEquivale afloat('nan')la salida de.

Sintaxis

La sintaxis de la constante math.nan es la siguiente:

math.nan

Valor de retorno

Devuelve un número flotante nan.

Ejemplo

El siguiente ejemplo devuelve nan:

Ejemplo

# Importar el paquete math
import math

# Imprime nan
print (math.nan)

# Imprime el tipo de nan
print (type(math.nan))

Resultado:

nan
<class 'float'>

Python math 模块Módulo math de Python

Otras extensiones