[NumPy-Tickets] [NumPy] #2033: a ** 2.0 has incorrect type
NumPy Trac
numpy-tickets@scipy....
Mon Jan 30 09:54:41 CST 2012
#2033: a ** 2.0 has incorrect type
------------------------+---------------------------------------------------
Reporter: kasal | Owner: somebody
Type: defect | Status: new
Priority: normal | Milestone: Unscheduled
Component: numpy.core | Version: 1.6.0
Keywords: |
------------------------+---------------------------------------------------
Hello,
I observe an incorrect evaluation of the power operator for the exponent =
2.0:
{{{
print 'NumPy:', np.__version__
a = np.array([2, 4], dtype=np.int16)
for e in np.arange(5.0):
s = 'a**{}'.format(e)
print '{:9} {}'.format(s, repr(eval(s)))
!NumPy: 1.6.0
a**0.0 array([ 1., 1.])
a**1.0 array([ 2., 4.])
a**2.0 array([ 4, 16], dtype=int16)
a**3.0 array([ 8., 64.])
a**4.0 array([ 16., 256.])
}}}
In all other cases, the output dtype is float, because of te float
exponent. But 'a**2.0' seems to be incorrectly reduced to 'a*a'.
--
Ticket URL: <http://projects.scipy.org/numpy/ticket/2033>
NumPy <http://projects.scipy.org/numpy>
My example project
More information about the NumPy-Tickets
mailing list