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

Huaiyu Zhu huaiyu at gauss.almadan.ibm.com
Mon Mar 4 16:57:02 EST 2002


On Sun, 03 Mar 2002 00:44:50 +0100, Alberto Griggio <albgrig at tiscalinet.it>
wrote: 
>
>#include <stdio.h>
>#include <math.h>
>#include <errno.h>
>#include <string.h>
>
>int main(void)
>{
>    double d;
>    errno = 0;
>    d = pow(1e-200, 2);
>    if(!errno) printf("OK: %f\n", d);
>    else printf("Error: %d, %s\n", errno, strerror(errno));
>    return errno;
>}
>
>prints: Error: 34, Numerical result out of range
>
>On slackware 8.0, GCC 2.95.3, libc 2.2.3, both the python and the C
>code fail.
>
>Finally, if you change pow to powf in the C code above, it gives no 
>error.
>
>Hope someone can understand what's happening...

It's more strange than first thought.  This produce errno 34 on BOTH the
following systems, but one raises exception while the other does not.

Red Hat 6.1 upgraded piecewise to 7.1:
C produce errno 34, but Python 2.2 does not raise.

SuSE 7.1:
C produce errno 34, and Python 2.2 raise.  Details here

$ python
Python 2.2 (#1, Feb 28 2002, 16:44:48) 
[GCC 2.95.2 19991024 (release)] on linux2
$ rpm -q gcc glibc
gcc-2.95.2-149
glibc-2.2-7

Can someone please expand on the above C program to test from other possible
culprits?


Huaiyu





More information about the Python-list mailing list