I’m assuming this error can be simplified down to…
julia> using DoubleFloats
julia> FloatFormt = Double64; #Double32, Double16
julia> N = 12
julia> h = FloatFormt((0:1:N-1)/N);
ERROR: MethodError: no method matching Double64(::StepRangeLen{Float64, Base.TwicePrecision{Float64}, Base.TwicePrecision{Float64}, Int64})
Closest candidates are:
(::Type{T})(::AbstractChar) where T<:Union{AbstractChar, Number} at char.jl:50
(::Type{T})(::Base.TwicePrecision) where T<:Number at twiceprecision.jl:266
DoubleFloat{T}(::T, ::DoubleFloat{T}) where T<:Union{Float16, Float32, Float64} at ~/.julia/packages/DoubleFloats/XUcgs/src/Double.jl:1
Using broadcasting there will help…
julia> h = FloatFormt.((0:1:N-1)/N)
12-element Vector{Double64}:
0.0
0.08333333333333333
0.16666666666666666
0.25
.
.
.
I would recommend not using this structure though as you can use more type generic code based on your input arguments. So something like
function foo(x::Vector{T}) where T
# use type of T for conversions within function
end
Now you can use T
for precision parameters within function based on your input types.