Skip to content
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

Problem with rand(typemin(Int32):typemax(Int32)) #5550

Closed
mschauer opened this issue Jan 26, 2014 · 2 comments
Closed

Problem with rand(typemin(Int32):typemax(Int32)) #5550

mschauer opened this issue Jan 26, 2014 · 2 comments

Comments

@mschauer
Copy link
Contributor

On a 64-bit system, typemin(Int32):typemax(Int32) is a legal Range who's length is strictly Int64. Should this be allowed? In that case, rand() breaks down.

julia> r = typemin(Int32):typemax(Int32)
-2147483648:2147483647
julia> typeof(r)
Range1{Int32} (constructor with 2 methods)
julia> length(r)
4294967296
julia> rand(r)
integer division error
mschauer added a commit to mschauer/julia that referenced this issue Jan 26, 2014
mschauer added a commit to mschauer/julia that referenced this issue Jan 26, 2014
mschauer added a commit to mschauer/julia that referenced this issue Jan 26, 2014
mschauer added a commit to mschauer/julia that referenced this issue Jan 26, 2014
mschauer added a commit to mschauer/julia that referenced this issue Jan 26, 2014
mschauer added a commit to mschauer/julia that referenced this issue Jan 26, 2014
@StefanKarpinski
Copy link
Sponsor Member

Thanks for testing the corner cases of this stuff.

@mschauer
Copy link
Contributor Author

Fixed by #5741

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants