-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
InexactError(): using range with higher values than Int64 #10554
Comments
You don't even need to run loops to reproduce this: julia> range(1,Int128(170141183460469231731687303715884105727))
ERROR: InexactError()
in convert at int.jl:157
julia> 1:Int128(170141183460469231731687303715884105727)
1:170141183460469231731687303715884105727 |
Even clearer: julia> UnitRange{Int64}(1, Int128(typemax(Int64)))
1:9223372036854775807
julia> UnitRange{Int64}(1, Int128(typemax(Int64))+1)
ERROR: InexactError()
in convert at int.jl:157
|
Should this line Line 77 in 288ea08
? |
How would I think the current behaviour is good enough, unless we decide to do a sensible checks for bounds, and add sensible errors when things overflow. |
Right now that gives me |
That is a range with length of -1 (ie empty), when you would expect an error. |
I think the |
Simple promotion will not do, one would expect |
…pplicable) (JuliaLang#43059) Be careful to use `oneunit` instead of `1`, so that arithmetic on user-given types does not promote first to Int. Fixes JuliaLang#35711 Fixes JuliaLang#10554
…pplicable) (JuliaLang#43059) Be careful to use `oneunit` instead of `1`, so that arithmetic on user-given types does not promote first to Int. Fixes JuliaLang#35711 Fixes JuliaLang#10554
Just played around and saw this:
Julia
Version 0.4.0-dev+3878 (2015-03-18 02:09 UTC)
Commit 17abcd9* (0 days old master)
x86_64-unknown-linux-gnu
Test code
OUTPUT
Cheers
P
The text was updated successfully, but these errors were encountered: