Python math - inf
The Python math.inf returns a floating-point positive infinity. For negative infinity -math.inf can be used. It is equivalent to the output of float('inf').
Syntax
#New in version 3.5 math.inf
Parameters
No parameter is required.
Return Value
Returns a floating-point positive infinity.
Example:
The example below shows the usage of math.inf.
import math #print the positive infinity print(math.inf) #print the negative infinity print(-math.inf)
The output of the above code will be:
inf -inf
❮ Python Math Module