[Numpy-discussion] numpy bug with negative int pow

Dmitrey tmp50 at ukr.net
Tue Aug 13 06:30:40 EDT 2013


Python 3.3.1 (default, Apr 17 2013, 22:32:14) 
[GCC 4.7.3] on linux 

>>> import numpy 
>>> numpy.__version__ 
'1.8.0.dev-d62f11d' 

>>> numpy.array((1,2,3)) / 2 
array([ 0.5,  1. ,  1.5]) 

#ok, but since division of integer arrays has been converted to float, pow is expected as well, but it's not: 

>>> numpy.array((1,2,3)) ** -1 
array([1, 0, 0], dtype=int32) 

>>> numpy.array((1,2,3)) ** -2 
array([1, 0, 0], dtype=int32) 

>>> 3**-1 
0.3333333333333333 

D. 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20130813/df7d0710/attachment.html>


More information about the NumPy-Discussion mailing list