Jan-25-2022, 08:06 AM
(This post was last modified: Jan-25-2022, 08:10 AM by Gribouillis.)
I guess it is because a 64 bits signed integer can store values between -2**63 and +2**63-1, which order of magnitude is 10**19, but here the result has a magnitude of 10**23. It follows that some bits are silently lost by overflow in the computation with 64 bits integers. Here is an example
>>> import array >>> a = array.array('q') >>> x = 2**63-1000 >>> x 9223372036854774808 >>> a.append(x) >>> a array('q', [9223372036854774808]) >>> import numpy as np >>> np.dot(a, a) 1000000 >>> x * x 85070591730234597419099578148391436864 >>>