Pythoncmath.inf Constant
Example
Print the positive and negative infinity:
#Import cmath Library
import cmath
# Print the positive infinity
print (cmath.inf)
# Print the negative infinity
print (-cmath.inf)
Try it Yourself »import cmath
# Print the positive infinity
print (cmath.inf)
# Print the negative infinity
print (-cmath.inf)
Definition and Usage
Thecmath.inf constant returns a floating-point positive infinity.
For negative infinity, use-cmath.inf.
The cmath.inf constant is equivalent tofloat("inf").
Syntax
cmath.inf
Technical Details
| Return Value: | Afloat value, representing the value of positive infinity |
|---|---|
| Python Version: | 3.6 |

