[Numpy-discussion] RE: Python 2.2 seriously crippled for numerical computation?

Michael Hudson mwh at python.net
Sun Mar 3 12:01:44 EST 2002


Konrad Hinsen <hinsen at cnrs-orleans.fr> writes:

> Tim Peters <tim.one at comcast.net> writes:
> 
> > > # Python 2.2
> > >
> > > >>> 1e-200**2
> > > Traceback (most recent call last):
> > >   File "<stdin>", line 1, in ?
> > > OverflowError: (34, 'Numerical result out of range')
> > 
> > That one is surprising and definitely not intended:  it suggests your
> > platform libm is setting errno to ERANGE for pow(1e-200, 2.0), or that your
> > platform C headers define INFINITY but incorrectly, or that your platform C
> > headers define HUGE_VAL but incorrectly, or that your platform C compiler
> > generates bad code, or optimizes incorrectly, for negating and/or comparing
> 
> I just tested and found the same behaviour, on RedHat Linux 7.1
> running on a Pentium machine. Python 2.1, compiled and running on the
> same machine, returns 0. So does the Python 1.5.2 that comes with the
> RedHat installation. Although there might certainly be something wrong
> with the C compiler and/or header files, something has likely changed
> in Python as well in going to 2.2, the only other explanation I see
> would be a compiler optimization bug that didn't have an effect with
> earlier Python releases.

A random memory byte suggests that whether Python links with -lieee or
not affects this behaviour.

Cheers,
M.

-- 
  About the use of language: it is impossible to sharpen a
  pencil with a blunt axe.  It is equally vain to try to do
  it with ten blunt axes instead.
      -- E.W.Dijkstra, 18th June 1975. Perl did not exist at the time.



More information about the Python-list mailing list