Rappresenting infinite

John Nagle nagle at animats.com
Fri Jun 29 21:00:30 CEST 2007


Robert Kern wrote:
> mmanns at gmx.net wrote:
> 
>>On Thu, 28 Jun 2007 23:20:30 -0500
>>Robert Kern <robert.kern at gmail.com> wrote:
>>
>>
>>>mmanns at gmx.net wrote:
>>>
>>>>Does it differ from the
>>>>built-in inf?
>>>
>>>What built-in inf?
>>
>>$ python
>>Python 2.4.4 (#2, Apr  5 2007, 20:11:18)
>>[GCC 4.1.2 20061115 (prerelease) (Debian 4.1.1-21)] on linux2
>>Type "help", "copyright", "credits" or "license" for more information.
>>
>>>>>a = 1.0e1000
>>>>>b = 2.0e1000
>>>>>a
>>
>>inf
>>
>>>>>b
>>
>>inf
>>
>>>>>a == b
>>
>>True
>>
>>>>>type(a)
>>
>><type 'float'>
> 
> 
> Okay, I thought you meant that there was an actual symbol 'inf' in the builtins
> or in a module somewhere.
> 
> 
>>>No. You can make one that fits your requirements, though.

    That sounds like a bug.  If Python numerics don't define
+INF, -INF, and NaN, along with the tests for them, that's a
flaw in the language.  We can assume IEEE floating point at this
late date; it's been standard for twenty years and Java assumes it.

				John Nagle



More information about the Python-list mailing list