Python math.inf Constant
Python math.infPositive infinity floating-point number, negative infinity, usage-math.inf 。
math.infEquivalent tofloat('inf')the output of.
Syntax
The math.inf constant syntax is as follows:
math.inf
Return Value
Returns a floating-point number representing positive infinity.
Example
The following example returns positive infinity and negative infinity:
Example
# Import math package
import math
# Output positive infinity
print (math.inf)
# Output negative infinity
print (-math.inf)
import math
# Output positive infinity
print (math.inf)
# Output negative infinity
print (-math.inf)
Output result:
inf -infOther Extensions
Python math Module