[Numpy-discussion] RE: Python 2.2 seriously crippled for numerical computation?
Alberto Griggio
albgrig at tiscalinet.it
Sat Mar 2 18:44:50 EST 2002
some other examples which may be useful...
Mandrake 8.1, GCC 3.0.2, libc 2.2.4
Python 2.2 (#3, Jan 28 2002, 11:45:43)
[GCC 3.0.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> 1e-200**2
0.0
>>>
but ...
#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...
Bye,
Alberto Griggio
More information about the Python-list
mailing list