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:

    math.nan

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

Example:

    Input:
    print(math.nan)

    Output:
    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






Comments and Discussions

Ad: Are you a blogger? Join our Blogging forum.
Learn PCB Designing: PCB DESIGNING TUTORIAL




Languages: » C » C++ » C++ STL » Java » Data Structure » C#.Net » Android » Kotlin » SQL
Web Technologies: » PHP » Python » JavaScript » CSS » Ajax » Node.js » Web programming/HTML
Solved programs: » C » C++ » DS » Java » C#
Aptitude que. & ans.: » C » C++ » Java » DBMS
Interview que. & ans.: » C » Embedded C » Java » SEO » HR
CS Subjects: » CS Basics » O.S. » Networks » DBMS » Embedded Systems » Cloud Computing » Machine learning » CS Organizations » Linux » DOS
More: » Articles » Puzzles » News/Updates

© https://www.includehelp.com some rights reserved.