I tried :
>>>a = np.array(2**np.arange(42)[::-1],dtype = np.uint64)
and got
>>> a
array([ 0, 0, 0,
0, 0, 0,
0, 0, 0,
0, 18446744071562067968, 1073741824,
536870912, 268435456, 134217728,
67108864, 33554432, 16777216,
8388608, 4194304, 2097152,
1048576, 524288, 262144,
131072, 65536, 32768,
16384, 8192, 4096,
2048, 1024, 512,
256, 128, 64,
32, 16, 8,
4, 2, 1], dtype=uint64)
18446744071562067968 is certainly not 2 to the power 31 and after that the answers are certainly not zero!
to check for some kind of overflow error I tried :
>>> a[0] = 2**42
and got:
>>> a
array([ 4398046511104, .....
the rest the same
Can anybody tell me what has gone wrong?
float(1/2)is0.0in Python 2 anddecimal.Decimal(1.0/10.0)isn'tdecimal.Decimal('0.1').