Closed jmsull closed 2 years ago
In the Base documentation for StepRange, it is stated that the types involved in StepRange should never be floats.
I believe you may be confusing the StepRange
type with the colon syntax. The colon syntax can produce many types of AbstractRange
s other than StepRange
.
julia> typeof(1:30)
UnitRange{Int64}
julia> typeof(1:2:40)
StepRange{Int64, Int64}
julia> typeof(1:2.:40)
StepRangeLen{Float64, Base.TwicePrecision{Float64}, Base.TwicePrecision{Float64}, Int64}
When we use floating point numbers with the colon syntax, we get a StepRangeLen
.
range
also can produce several types of AbstractRange
depending on the types provided as arguments.
julia> range(2,5) |> typeof
UnitRange{Int64}
julia> range(2,5, length=3) |> typeof
StepRangeLen{Float64, Base.TwicePrecision{Float64}, Base.TwicePrecision{Float64}, Int64}
julia> range(2,5, step=0.1) |> typeof
StepRangeLen{Float64, Base.TwicePrecision{Float64}, Base.TwicePrecision{Float64}, Int64}
Thanks for the pointer about colon syntax.
In the Base documentation for StepRange, it is stated that the types involved in StepRange should never be floats.
However, for scaled BSplines, the Interpolations.jl documentation gives as an example exactly the thing Base says not to do.
Unless I am missing something, the Interpolations.jl examples should be updated? e.g. to use range(...)?