You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Unexpected integer division/modulus result when using np.uint64 #10148
Floating point result will appear if using numpy array of type uint64. This leads to numerically incorrect result when number is sufficiently large.
Tested on Python 3.5.2, numpy 1.13.3, on Windows 10 Build 17046.1000 (Insider Preivew)
importnumpyasnpa=np.array([2], np.uint64)
print(31328281838316189%a[0]) # which gives 0.0, not 1 as expectedprint(31328281838316189//a[0]) # which gives 1.56641409192e+16, not 15664140919158094 as expected
This problem will not occur if I replace uint64 with int64.
Activity
hanzhi713 commentedon Dec 2, 2017
It seems to be related to #5745 and #7126. This causes problems when doing large number arithmetic.
ahaldane commentedon Mar 23, 2019
Reviewing this as part of my 10 random issues, as requested in a 3/20/19 request.
I'm going to close this as a duplicate issue. See #12525 for the main discussion.