[Numpy-discussion] Bitwise operations and unsigned types

Travis Oliphant travis at continuum.io
Fri Apr 6 02:22:55 EDT 2012


> 
> Although 1.5.1 also gives
> 
> >>> np.uint(3) + 4
> 7.0
> 
> i.e., a float, which certainly doesn't look right either. Whereas
> 
> >>> np.int(3) + 4
> 7
> 
> The float promotion is still there in 1.6.1
> 
> In [4]: uint64(1) + 2
> Out[4]: 3.0
> 
> So I suppose there is the larger question is how combining numpy scalars with python scalars should be done in general.
> 

Yes, exactly!  This is a good discussion to have.   As mentioned before, I would also like to see the NumPy scalars get their own math instead of re-using the umath machinery.      In the case of scalars, it would seem to make sense to interpret integers as signed or unsigned based on their value.   


-Travis

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


More information about the NumPy-Discussion mailing list