[Numpy-tickets] [NumPy] #301: power with negative argument returns 0

NumPy numpy-tickets at scipy.net
Sat Sep 30 17:18:36 CDT 2006

#301: power with negative argument returns 0
 Reporter:  stefan      |       Owner:  somebody   
     Type:  defect      |      Status:  new        
 Priority:  normal      |   Milestone:  1.0 Release
Component:  numpy.core  |     Version:             
 Severity:  normal      |    Keywords:             
 The power function returns an (incorrect) value for negative powers of

 In [1]: N.power(3,-2)
 Out[1]: 0

 Unlike integer division, which is well defined, I am not sure what the
 behaviour of power should be. Tim Hochberg's comment on the topic can be
 seen on the mailing list thread at


 In short, it offers the possibility of making numpy.power behave like
 Python's math.pow, which always returns floats, whereas x**y will be
 equivalent to the Python ** integer behaviour.

Ticket URL: <http://projects.scipy.org/scipy/numpy/ticket/301>
NumPy <http://projects.scipy.org/scipy/numpy>
The fundamental package needed for scientific computing with Python.

More information about the Numpy-tickets mailing list