[Numpy-discussion] Handling of numpy.power(0, <something>)
Stuart Brorson
sdb@cloud9....
Thu Feb 28 14:23:34 CST 2008
> 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).
Thanks for the info!
> For pow the C99 says:
>
>>>> math.pow(0, 0)
> 1.0
OK. I've come around to think this is the "right" answer.
>>>> math.pow(0, 1)
> 0.0
OK.
> [30859 refs]
>>>> math.pow(0, float("inf"))
> 0.0
OK. But what about
math.pow(0, -1*float("inf"))
>>>> math.pow(0, float("nan"))
> nan
OK.
>>>> math.pow(0, -1)
> Traceback (most recent call last):
> File "<stdin>", line 1, in <module>
> ValueError: math domain error
Why isn't this one inf?
Also, what do these specs say about 0^<complex>?
Cheers,
Stuart Brorson
Interactive Supercomputing, inc.
135 Beaver Street | Waltham | MA | 02452 | USA
http://www.interactivesupercomputing.com/
More information about the Numpy-discussion
mailing list