Home » Python

math.nan constant with example in Python

Python math.nan constant: Here, we are going to learn about the math.nan constant of math module with example in Python.
Submitted by IncludeHelp, on April 19, 2019

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').

Note: math.nan constant is available from Python 3.5

Syntax of math.nan constant:


Return value: float It returns a float value (nan) – that is the floating-point "Not a Number".




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)


value of NaN = nan

Reference: Python math library

Comments and Discussions!

Load comments ↻

Copyright © 2024 www.includehelp.com. All rights reserved.