[Numpy-discussion] Handling of numpy.power(0, <something>)
Thu Feb 28 14:16:23 CST 2008
Stuart Brorson wrote:
> I have been poking at the limits of NumPy's handling of powers of
> zero. I find some results which are disturbing, at least to me.
> Here they are:
Please checkout Mark Dickinson's and my trunk-math branch of Python 2.6.
We have put lots of effort into fixing edge cases of floats, math and
cmath functions. The return values are either based on the latest
revision of IEEE 754 or the last public draft of the C99 standard (1124,
Annex F and G).
For pow the C99 says:
>>> math.pow(0, 0)
>>> math.pow(0, 1)
>>> math.pow(0, float("inf"))
>>> math.pow(0, float("nan"))
>>> math.pow(0, -1)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ValueError: math domain error
More information about the Numpy-discussion