New submission from benma <[email protected]>:

Hi

a = np.array([1,2,3], dtype=np.int16)
# outputs dtype('int64') instead of dtype('int16')
print (a*2).dtype 

Same thing happens with floats. dtype is resetted to the default dtype, 64 bits
on my machine. numpy on CPython keeps the original dtype. 

I ran into this bug when I used (a*2) as an input to a C function and the size
(in bytes) of each element doubled.

Best, Marko

----------
messages: 6143
nosy: benma, pypy-issue
priority: bug
release: 2.1
status: unread
title: Multiplication of np.ndarray with a Python int or float results in loss 
of dtype

________________________________________
PyPy bug tracker <[email protected]>
<https://bugs.pypy.org/issue1598>
________________________________________
_______________________________________________
pypy-issue mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-issue

Reply via email to