How to represent the infinite ?
Huaiyu Zhu
huaiyu at gauss.almadan.ibm.com
Thu Jun 20 23:14:53 EDT 2002
Christophe Delord <christophe.delord at free.fr> wrote:
>On Thu, 20 Jun 2002 20:11:25 +0000 (UTC)
>huaiyu at gauss.almadan.ibm.com (Huaiyu Zhu) wrote:
>
>> Christophe Delord <christophe.delord at free.fr> wrote:
>> [regarding 1e1000 giving inf]
>> >With Python 2.2 and Linux it works. The example I gave is a copy-paste from IDLE. It also works with my Python 1.5.2 and 2.3 (I'm under Linux on an Intel processor)
>>
>> Does 1e200**2 also work for you out of the box? I had to get rid of the
>> artificial check for overflow in the source to really use inf in
>> computations. I don't remember if 1e1000 works on my box without patch.
>
>
>>>> 1e200**2
>Traceback (most recent call last):
> File "<pyshell#1>", line 1, in ?
> 1e200**2
>OverflowError: (34, 'Numerical result out of range')
>>>> 1e400
>inf
>
>When the overflow occurs, the OverflowError exception is thrown. inf can't be the result of a computation (without patch and without catching exception).
OK, that's what I thought. I still don't understand why it should default
to disabling inf and nan in computation. I've lived without the overflow
checking for a year, without noticeable bad effect (with much benefit, of
course).
Huaiyu
More information about the Python-list
mailing list