Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

Python math.inf Constant

Python math.inf Constant

Python math Module Python math Module

Python math.inf A floating-point value for positive infinity; for negative infinity, use -math.inf.

math.inf Equivalent to the output of float('inf').

Syntax

The syntax of the math.inf constant is as follows:

math.inf

Return Value

Returns a floating-point number representing positive infinity.

Example

The following example returns positive and negative infinity:

Example

Import the math package

import

math

Output positive infinity

print

(

math

.

inf

)

Output negative infinity

print

(

math

.

inf

)

Output result:


inf
-inf

Python math Module Python math Module