Question
Unexpected uint64 behaviour 0xFFFF'FFFF'FFFF'FFFF - 1 = 0?
Consider the following brief numpy session showcasing uint64
data type
import numpy as np
a = np.zeros(1,np.uint64)
a
# array([0], dtype=uint64)
a[0] -= 1
a
# array([18446744073709551615], dtype=uint64)
# this is 0xffff ffff ffff ffff, as expected
a[0] -= 1
a
# array([0], dtype=uint64)
# what the heck?
I'm utterly confused by this last output.
I would expect 0xFFFF'FFFF'FFFF'FFFE.
What exactly is going on here?
My setup:
>>> sys.platform
'linux'
>>> sys.version
'3.10.5 (main, Jul 20 2022, 08:58:47) [GCC 7.5.0]'
>>> np.version.version
'1.23.1'