Python cmath.nan() 方法

定义和用法

cmath.nan 常量返回一个浮点型的非数字(Not a Number)值。这个值不是一个合法的数字。

nan 常量相当于 float("nan")math.nan

实例

打印 nan 的值:

# 导入 cmath 库  
import cmath   
  
# 打印 nan 的值  
print (cmath.nan)

亲自试一试

语法

cmath.nan

技术细节

返回值: 浮点数值,nan(非数字)。
Python 版本: 3.6