I am trying to create a single valued array called xs
in which I am later pushing in values.
xs = [x0,]
where x0
is obtained through a slider in Pluto notebook as follows.
@bind x0 Slider(0.0:0.01:0.99, show_value=true)
However, when x0
is set as 0.0
, it results in the xs
being created as Int64
array which raises error while pushing further values into it.
InexactError: Int64(0.09685647168069829)
Int64@float.jl:723[inlined]
convert@number.jl:7[inlined]
push!(::Vector{Int64}, ::Float64)@array.jl:928
top-level scope@Local: 10[inlined]
Shouldn’t the xs
be created as Float64
array since x0
is of that type? Also, is there a way to prevent this issue?