0 
How can I represent an infinite number in Python? 
user7891

1^{#}
user7891 Published in September 19, 2018, 6:42 pm


Related posts


You need to login account before you can post.

float('inf')
– JBernardo Oct 15 '11 at 23:10math.inf
is useful as an initial value in optimisation problems, because it works correctly with min, eg.min(5, math.inf) == 5
. For example, in shortest path algorithms, you can set unknown distances tomath.inf
without needing to special caseNone
or assume an upper bound9999999
. Similarly, you can usemath.inf
as a starting value for maximisation problems. – Colonel Panic Oct 12 '16 at 10:59