The Python Apprentice
上QQ阅读APP看书,第一时间看更新

Special floating point values

By passing certain strings to the float constructor, we can create the special floating point value NaN (short for Not a Number) and also positive and negative infinity:

>>> float("nan")
nan
>>> float("inf")
inf
>>> float("-inf")
-inf