Python math.inf Constant
Example
Print the positive and negative infinity:
    # Import math Library
import math 
# Print the positive infinity
    print (math.inf)
# Print the negative infinity
print (-math.inf)
  Try it Yourself »
Definition and Usage
The math.inf constant returns a floating-point positive infinity.
For negative infinity, use -math.inf.
The inf constant is equivalent to float('inf').
Syntax
math.inf
Technical Details
| Return Value: | A float value, representing the value of positive infinity | 
|---|---|
| Python Version: | 3.5 | 
Copyright 1999-2023 by Refsnes Data. All Rights Reserved.