On Thu, Apr 5, 2012 at 11:39 PM, Charles R Harris <charlesr.har...@gmail.com > wrote:
> > > On Thu, Apr 5, 2012 at 11:16 PM, Travis Oliphant <tra...@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. > > In particular, in this case it is because two scalars are used. It works fine for arrays In [11]: ones(3, uint64) & 3 Out[11]: array([1, 1, 1], dtype=uint64) Chuck
_______________________________________________ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion