[Numpy-discussion] Bitwise operations and unsigned types

Charles R Harris charlesr.harris at gmail.com
Fri Apr 6 01:39:14 EDT 2012


On Thu, Apr 5, 2012 at 11:16 PM, Travis Oliphant <travis at continuum.io>wrote:

> Which version of NumPy are you using.  This could be an artefact of the
> new casting rules.
>
> This used to work.   So, yes, this is definitely a bug.
>
>
It's because the '3' is treated as signed, so the uint64 needs to be cast
to something of higher precision, of which there is none. You can either
use uint64(3) or just stick to int64. I don't know if this used to work or
not, mixing signed and unsigned has always led to higher precision in
arithmetic operations, even (mistakenly in my opinion) promoting uint64(5)
+ 3 to lower precision float64.

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


More information about the NumPy-Discussion mailing list