strange casting rules
29 Jul
2015
29 Jul
'15
7:07 a.m.
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.
29 Jul
29 Jul
7:31 a.m.
On Wed, Jul 29, 2015 at 1:07 PM, Neal Becker
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: http://mail.scipy.org/pipermail/numpy-discussion/2015-July/073196.html Cast your 0 to a uint64 or other unsigned int type to avoid this. -- Robert Kern
3191
Age (days ago)
3191
Last active (days ago)
1 comments
2 participants
participants (2)
-
Neal Becker
-
Robert Kern