Thomas Jung
Thomas Jung

Reputation: 33092

Constants for infinity

Are there constants for infinity in python?

The only way I found was to parse the values from a string.

INF = float("inf")
NINF = float("-inf")

Upvotes: 3

Views: 265

Answers (2)

avasal
avasal

Reputation: 14854

You can use

inf = 1e3000
ninf = -1e3000

Upvotes: 4

Ignacio Vazquez-Abrams
Ignacio Vazquez-Abrams

Reputation: 798606

No. Even fpconst generates them by unpacking the IEEE 754 bit sequences.

Upvotes: 4

Related Questions