Python math.nan Constant

❮ Math Methods


Example

Print the value of nan:

# Import math Library
import math

# Print the value of nan
print (math.nan)
Try it Yourself »

Definition and Usage

The math.nan constant returns a floating-point nan (Not a Number) value. This value is not a legal number.

The nan constant is equivalent to float('nan').


Syntax

math.nan

Technical Details

Return Value: A float value, nan (Not a Number)
Python Version: 3.5

❮ Math Methods

Copyright 1999-2023 by Refsnes Data. All Rights Reserved.