Python3 math.nan常量 - 非法数字

 math 模块


描述

Python math.nan 返回一个浮点值 nan(not a number,不是一个数字),这个值不是一个合法数字。

math.nan 相当于 float(‘nan’) 的输出。


语法

math.nan 常量语法如下:

math.nan

返回值

返回一个浮点数 nan。


实例

以下实例返回 nan:

# 导入 math 包
import math

# 输出 nan
print (math.nan)

# 输出 nan 类型
print (type(math.nan))

尝试一下

输出结果:

nan
<class 'float'>

 math 模块

版权声明:本文由lzhuji.com主机评测所有
文章名称:《Python3 math.nan常量 - 非法数字》
文章链接:https://www.lzhuji.com/254654.html
本站资源仅供个人学习交流,请于下载后24小时内删除,不允许用于商业用途,否则法律问题自行承担。

本站不对信息的真伪做任何的保障,请自行甄别,自负责任。

登录

找回密码

注册