Python math.nan常数 (Python math.nan constant)
math.nan constant is a predefined constant, which is defined in the math module, it returns floating-point nan (Not a Number), which is equivalent to float('nan').
math.nan常数是在math模块中定义的预定义常数,它返回浮点nan (不是数字),等效于float('nan') 。
Note: math.nan constant is available from Python 3.5
注意: math.nan常数可从Python 3.5获得
Syntax of math.nan constant:
math.nan常数的语法:
math.nan
Return value: float It returns a float value (nan) – that is the floating-point "Not a Number".
返回值: float它返回一个浮点值(nan)-浮点数“不是数字”。
Example:
例:
Input:
print(math.nan)
Output:
nan
Python代码演示math.nan常量示例 (Python code to demonstrate example of math.nan constant)
# python code to demonstrate example of
# math.nan constant
# importing math module
import math
# printing value of nan
print("value of NaN = ", math.nan)
Output
输出量
value of NaN = nan
Reference: Python math library
参考: Python数学库
翻译自: https://www.includehelp.com/python/math-nan-constant-with-example.aspx