Hello! I’ve recently found a weird behaviour of StepLenRange
. Consider:
N = 10
faces = range(start=0, stop=1, length=(N + 1))
cells = range(start=(0 + faces.step), step=faces.step, length=N)
On my computer (julia v.1.7.2
) it produces the following error:
ERROR: MethodError: no method matching zero(::Base.TwicePrecision{Float64})
Stacktrace:
[1] _rangestyle(#unused#::Base.Unordered, #unused#::Base.ArithmeticUnknown, a::Base.TwicePrecision{Float64}, step::Base.TwicePrecision{Float64}, len::Int64)
@ Base .\range.jl:168
[2] range_start_step_length(a::Base.TwicePrecision{Float64}, step::Base.TwicePrecision{Float64}, len::Int64)
So, I think the problem with 0 + faces.step
. But is this a bug or a feature?
EDIT:
the following works well:
x = 0:0.1:1
step = x.step
0 + x.step
which produces:
Base.TwicePrecision{Float64}(0.1, -5.551115123125763e-18)