numpy, overflow, inf, ieee, and rich comparison

Huaiyu Zhu hzhu at yahoo.com
Tue Oct 10 03:46:03 EDT 2000


Well, maybe this is a 2.0 bug (or feature)?

On Mon, 9 Oct 2000 22:25:59 -0400, Tim Peters <tim_one at email.msn.com> wrote:
>
>While that's inherited from your libc.
...
>
>I haven't used Numeric, but I do guess you're simply hosed without resorting
>to C.

I thought so, BUT 

$ /usr/bin/python
Python 1.5.2 (#1, Sep 17 1999, 20:15:36)  [GCC egcs-2.91.66 19990314/Linux
(egcs- on linux-i386
Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam
>>> from math import *
>>> exp(-745)
4.94065645841e-324
>>> exp(-746)
0.0

$ /usr/local/bin/python
Python 2.0b2 (#2, Oct  6 2000, 17:54:55) 
[GCC egcs-2.91.66 19990314/Linux (egcs-1.1.2 release)] on linux2
Type "copyright", "credits" or "license" for more information.
>>> from math import *
>>> exp(-745)
4.9406564584124654e-324
>>> exp(-746)
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
OverflowError: math range error

This is on the same machine. Notice that GCC?  Exactly the same version.  So
what's going on here?  I was wondering why I hadn't noticed this underflow
for such a long time ... 

Maybe 2.0 fixes Window's bug wile introducing Linux bug? One thing I can
confirm is that Numeric behaves the same as math in this regard.

Huaiyu



More information about the Python-list mailing list