How to represent the infinite ?

Christophe Delord christophe.delord at free.fr
Thu Jun 20 16:53:55 EDT 2002


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).

> 
> Huaiyu


-- 

(o_   Christophe Delord                   _o)
//\   http://christophe.delord.free.fr/   /\\
V_/_  mailto:christophe.delord at free.fr   _\_V



More information about the Python-list mailing list