📜  Python| cmath.nan 常量

📅  最后修改于: 2022-05-13 01:55:36.550000             🧑  作者: Mango

Python| cmath.nan 常量

cMath 模块包含许多用于复数数学运算的函数。 cmath.nan常量用于获取浮点 nan(非数字)。

下面的例子说明了上述函数的使用:

示例 #1:

Python3
# Python code to implement
# the cmath.nan constant
        
# importing "cmath"
# for mathematical operations  
import cmath 
    
# Print the value of nan
val = cmath.nan 
print(val)


Python3
# Python code to implement
# the cmath.nan constant
        
# importing "cmath"
# for mathematical operations  
import cmath 
    
# use of cmath.nan
val = cmath.isnan(cmath.nan)
print(val)


输出:

nan

示例 #2:

Python3

# Python code to implement
# the cmath.nan constant
        
# importing "cmath"
# for mathematical operations  
import cmath 
    
# use of cmath.nan
val = cmath.isnan(cmath.nan)
print(val)

输出:

True