-
Notifications
You must be signed in to change notification settings - Fork 194
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
counts(x::IntegerArray)
doesn't play nice with arrays of random integers
#617
Comments
The error seems to indicate something else is wrong. This is arithmetic overflow |
The overflow is from here: Line 80 in 591d045
My point is that the method |
The length of this range is beyond julia> i = -8355145859230963484:7853550526759645744
-8355145859230963484:7853550526759645744
julia> typeof(i)
UnitRange{Int64}
julia> big(7853550526759645744) - -8355145859230963484 > typemax(Int64)
true Related issue: JuliaLang/julia#26608 |
Ok, I see that I should be using |
When applied to integers, the
counts
function tries to create an array to save the counts that it passes toaddcounts!
.The problem is that the algorithm assumes any integer is possible between the smallest and largest values so it tries to create a huge array that easily is way to big to be allocated and even the calculation of the size of the array easily overflows Int:
yields on one run:
Wouldn't some kind of
Dict
based method be more robust?The text was updated successfully, but these errors were encountered: