Consider the array
a = np.array([64, 8, 16, 24, 32, 40, 48, 56, 64])
Its first and last elements are identical
a[0] == a[-1]
# True
Now let's left shift by a
b = 1<<a
And compare the first and last elements
b[0] == b[-1]
# False
What the heck is going on here?
Can anyone reproduce this? Is this a bug?
The actual values are
b
# array([ 0, 256, 65536,
# 16777216, 4294967296, 1099511627776,
# 281474976710656, 72057594037927936, 1])
numpy
version is 1.17.0 on Python
3.6.5
Expected Values
Either value has its logic: 0 = 1 * 2^64 mod 2^64 and 1 = 1 * 2^(64 mod 64)
Related
For me its showing true: python 3.7.4 numpy 1.17.x
import numpy
a = numpy.array([10,20,15,10])
a[0]==a[-1]
True
b = 1<<a
b[0] == b[-1]
True
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.