Possible bug (was Re: numpy, overflow, inf, ieee, and rich comparison)
David M. Cooke
cookedm at physics.mcmaster.ca
Thu Oct 12 22:59:49 EDT 2000
At some point, hzhu at yahoo.com (Huaiyu Zhu) wrote:
> On Wed, 11 Oct 2000 22:44:20 -0400, Tim Peters <tim_one at email.msn.com> wrote:
>
> >Apparently Python on libc+glibc+Linux never raised OverflowError from math.*
> >functions in 1.5.2 (although it did on most other platforms I know about).
>
> Is it just glibc or is it glibc+Linux? Here's test on my machine
>
> Without -lieee
> x exp(x) errno errmessage
> -745.0 4.94066e-324 0 Success
> -746.0 0 34 Numerical result out of range
> 709.0 8.21841e+307 34 Numerical result out of range
> 710.0 inf 34 Numerical result out of range
> sqrt( -1.0) = nan, 33 Numerical argument out of domain
>
> On all the other platforms, what happens when you use ieee confirming flags?
> I'd bet they behave pretty much the same. Anyone on other platform care to
> check out? Here's the C program
Even on glibc+Linux, it depends on the optimizations: for my machine
running Linux-Mandrake 7.1 (glibc 2.1.3):
Without -lieee, and without -O, I get your results above.
Without -lieee, but compiled with -O, I get
x exp(x) errno errmessage
-745.0 4.94066e-324 0 Success
-746.0 0 0 Success
709.0 8.21841e+307 0 Success
710.0 inf 0 Success
sqrt( -1.0) = nan, 0 Success
However, on my Debian machine (with glibc 2.1.94) I get the first
behaviour for compiling with -O (and higher). The compilers are both
gcc 2.95.2.
This is the reason exp behaves differently in Python on my work
machine (with Linux-Mandrake) and on my home machine (with Debian):
Mandrake compiles Python with optimizations (more severe than -O).
This was a pain in the a** for some numerical code I was writing.
--
|>|\/|<
----------------------------------------------------------------------------
David M. Cooke
cookedm at physics.mcmaster.ca
More information about the Python-list
mailing list