-
-
Notifications
You must be signed in to change notification settings - Fork 5.7k
Closed
Labels
good first issueIndicates a good issue for first-time contributors to JuliaIndicates a good issue for first-time contributors to Julia
Description
Working on #41769, I found an error:
julia> r = StepRangeLen(3, 0, 5)
StepRangeLen(3, 0, 5)
julia> 3 in r
ERROR: DivideError: integer division error
Stacktrace:
[1] div
@ ./int.jl:278 [inlined]
[2] div
@ ./div.jl:257 [inlined]
[3] div
@ ./div.jl:302 [inlined]
[4] fld
@ ./div.jl:268 [inlined]
[5] mod
@ ./int.jl:270 [inlined]
[6] in(x::Int64, r::StepRangeLen{Int64, Int64, Int64, Int64})
@ Base ./range.jl:1346
[7] top-level scope
@ REPL[23]:1This is because 3 is inside the range, and step(r) == 0 makes mod on this line fail.
Slightly related is #41402, which deals with a completely different problem, but eventually sees division error in mod. Perhaps mod should check the modulo and throw a better error too?
Metadata
Metadata
Assignees
Labels
good first issueIndicates a good issue for first-time contributors to JuliaIndicates a good issue for first-time contributors to Julia