Closed
Description
In Julia v1.7-beta:
julia> 2 * (1:big(100)^100)
ERROR: InexactError: Int64(100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000)
Stacktrace:
[1] Type
@ ./gmp.jl:363 [inlined]
[2] convert
@ ./number.jl:7 [inlined]
[3] StepRangeLen{BigInt, BigInt, BigInt}(ref::BigInt, step::BigInt, len::BigInt, offset::Int64)
@ Base ./range.jl:441
[4] StepRangeLen (repeats 2 times)
@ ./range.jl:445 [inlined]
[5] broadcasted(#unused#::Base.Broadcast.DefaultArrayStyle{1}, #unused#::typeof(*), x::Int64, r::UnitRange{BigInt})
@ Base.Broadcast ./broadcast.jl:1157
[6] broadcasted
@ ./broadcast.jl:1341 [inlined]
[7] broadcast_preserving_zero_d
@ ./broadcast.jl:892 [inlined]
[8] *(A::Int64, B::UnitRange{BigInt})
@ Base ./arraymath.jl:52
[9] top-level scope
@ REPL[9]:1
Previously:
julia> 2 * (1:big(100)^100)
2:2:200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
The issue is that StepRangeLen
only allows Int
lengths.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment