<p>在Matlab中(参见:<a href="http://www.mathworks.com/help/matlab/ref/inf.html" rel="nofollow">Inf</a>):</p>
<blockquote>
<p>Inf returns the IEEE® arithmetic representation for positive infinity.</p>
</blockquote>
<p>因此<code>Inf</code>产生一个大于所有其他数值的值。<code>-Inf</code>生成一个保证小于任何其他数值的值。当你想迭代地找到一个最大值,并且需要一个比第一个值小的第一个值时,通常使用它。在</p>
<p>根据维基百科(见:<a href="http://en.wikipedia.org/wiki/IEEE_754-1985#Positive_and_negative_infinity" rel="nofollow">IEEE 754 Inf</a>):</p>
<blockquote>
<p>Positive and negative infinity are represented thus:</p>
<p>sign = 0 for positive infinity, 1 for negative infinity.<br/>
biased exponent = all 1 bits.<br/>
fraction = all 0 bits.</p>
</blockquote>
<p>Python使用<code>'-inf'</code>具有相同的概念(请参见注释6<a href="https://docs.python.org/2/library/stdtypes.html#numeric-types-int-float-long-complex" rel="nofollow">here</a>):</p>
<blockquote>
<p>float also accepts the strings “nan” and “inf” with an optional prefix “+” or “-” for Not a Number (NaN) and positive or negative infinity.</p>
</blockquote>
<pre><code>>>> a=float('-inf')
>>> a
-inf
>>> b=-27983.444
>>> min(a,b)
-inf
</code></pre>