Related Articles

Related Articles

Python | cmath.nan Constant
  • Last Updated : 01 Jun, 2020

cMath module contains a number of functions which is used for mathematical operations for complex numbers. The cmath.nan Constant is used to get the floating-point nan (Not a Number).

Syntax: cmath.nan

Returns: Return the floating-point nan value.

Below examples illustrate the use of above function:

Example #1 : 



Python3

filter_none

edit
close

play_arrow

link
brightness_4
code

# 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)

chevron_right


Output:

nan

Example #2:

Python3

filter_none

edit
close

play_arrow

link
brightness_4
code

# 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)

chevron_right


Output:

True

Attention geek! Strengthen your foundations with the Python Programming Foundation Course and learn the basics.

To begin with, your interview preparations Enhance your Data Structures concepts with the Python DS Course.

My Personal Notes arrow_drop_up
Recommended Articles
Page :