[Numpy-discussion] RE: Python 2.2 seriously crippled for numerical computation?
Skip Montanaro
skip at pobox.com
Sat Mar 2 13:04:44 EST 2002
Fernando> It's not Python 2.2 itself:
Fernando> % python
Fernando> Python 2.2 (#1, Feb 10 2002, 13:29:43)
Fernando> [GCC 2.95.2 19991024 (release)] on darwin
Fernando> Type "help", "copyright", "credits" or "license" for more information.
>>>> 1e-200**2
Fernando> 0.0
According to the pow man page on my Mandrake 8.1 system it suggests that
ERANGE should be set if its first arg is zero. This appears to happen when
x is around 1.5717e-162. I suspect a bug in glibc (I have version 2.2.4).
In the region where the problem occurs, Python's float_pow() looks like
PyFPE_START_PROTECT("pow", return NULL)
ix = pow(iv, iw);
PyFPE_END_PROTECT(ix)
Py_SET_ERANGE_IF_OVERFLOW(ix);
Setting a break immediately after the pow() call shows that ERANGE is set
even though it appears to have correctly returned 0. Perhaps if iv < 1, ix
== 0, and errno is ERANGE, errno should be cleared, at least for certain
versions of glibc?
--
Skip Montanaro (skip at pobox.com - http://www.mojam.com/)
More information about the Python-list
mailing list