[Numpy-discussion] strange casting rules

Robert Kern robert.kern at gmail.com
Wed Jul 29 08:31:02 EDT 2015

On Wed, Jul 29, 2015 at 1:07 PM, Neal Becker <ndbecker2 at gmail.com> wrote:
> np.uint64(-1)+0
> Out[36]: 1.8446744073709552e+19
> I often work on signal processing requiring bit-exact integral arithmetic.
> Promoting to float is not helpful - I don't understand the logic of the
> above example.

See this thread:


Cast your 0 to a uint64 or other unsigned int type to avoid this.

Robert Kern
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20150729/fa7d87e4/attachment.html>

More information about the NumPy-Discussion mailing list