Mathematics in Python are not correct

Luis Zarrabeitia kyrie at uh.cu
Fri May 9 00:15:36 EDT 2008


Quoting Christian Heimes <lists at cheimes.de>:

> Luis Zarrabeitia schrieb:
> >>>> 0**0
> > 1
> > 
> > That 0^0 should be a nan or exception, I guess, but not 1.
> 
> No, that's correct for floats. Read the wikipedia article or the C99
> standard for more information.

Weird, I can't find neither... (which wikipedia article? Couldn't find one about
C99.)
Don't take me wrong, I believe you... but I would really want to see the logic
behind that. I pretty much like the NaNs and Infs (and don't really understand
why python raises float division errors instead of them), but to have errors
pass with absolute silence seems dangerous even if it is useful sometimes
(Vandermonde example). I think I'd rather have python returning NaNs and
violating C99 on the 0**0=1, than to have 0**0=1 and not return NaNs.


-- 
Luis Zarrabeitia
Facultad de Matemática y Computación, UH
http://profesores.matcom.uh.cu/~kyrie
--
"Al mundo nuevo corresponde la Universidad nueva"
UNIVERSIDAD DE LA HABANA
280 aniversario 



More information about the Python-list mailing list