[Numpy-discussion] RE: Python 2.2 seriously crippled for numerical computation?
Michael Hudson
mwh at python.net
Tue Mar 5 05:24:25 EST 2002
Alberto Griggio <albgrig at tiscalinet.it> writes:
> #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
Fun fun fun:
[mwh at starship foo]$ gcc alberto.c
/tmp/cce0jzts.o: In function `main':
/tmp/cce0jzts.o(.text+0x27): undefined reference to `pow'
collect2: ld returned 1 exit status
[mwh at starship foo]$ gcc alberto.c -lm
[mwh at starship foo]$ ./a.out
Error: 34, Numerical result out of range
[mwh at starship foo]$ gcc alberto.c -lm -lieee
[mwh at starship foo]$ ./a.out
OK: 0.000000
[mwh at starship foo]$ gcc -O9 alberto.c -lm
[mwh at starship foo]$ ./a.out
OK: 0.000000
[mwh at starship foo]$ gcc -O9 alberto.c
[mwh at starship foo]$ ./a.out
OK: 0.000000
When you use "-O9" I think gcc uses the fpu more directly.
Words are failing me.
Cheers,
M.
--
6. Symmetry is a complexity-reducing concept (co-routines include
subroutines); seek it everywhere.
-- Alan Perlis, http://www.cs.yale.edu/homes/perlis-alan/quotes.html
More information about the Python-list
mailing list