[Numpy-discussion] Handling of numpy.power(0, <something>)

Christian Heimes lists@cheimes...
Thu Feb 28 15:37:35 CST 2008

Stuart Brorson wrote:
>>>>> 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?

The standard says return inf and raise a divide-by-zero floating point
exception. Since we can't do both in Python we sticked to the exception

> Also, what do these specs say about 0^<complex>?

See for yourself
http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1124.pdf The
interesting information are in Annex F.9 and Annex G.6.

So far we haven't dealt with complex powers and Python doesn't support
0.**1j yet.


More information about the Numpy-discussion mailing list