FiniteDifferences.jl icon indicating copy to clipboard operation
FiniteDifferences.jl copied to clipboard

Type Conversion Error with Measurements

Open lstagner opened this issue 2 years ago • 1 comments

using FiniteDifferences
using Measurements

f(x) = cos(x + (1.0 ± 0.1)*sin(x))
m = central_fdm(5,1)

m(f, 0.0)

MethodError: no method matching Float64(::Measurement{Float64})
Closest candidates are:
  (::Type{T})(::Real, ::RoundingMode) where T<:AbstractFloat at rounding.jl:200
  (::Type{T})(::T) where T<:Number at boot.jl:772
  (::Type{T})(::AbstractChar) where T<:Union{AbstractChar, Number} at char.jl:50
  ...

Stacktrace:
 [1] _eval_function(m::FiniteDifferences.AdaptedFiniteDifferenceMethod{5, 1, FiniteDifferences.UnadaptedFiniteDifferenceMethod{7, 5}}, f::typeof(f), x::Float64, step::Measurement{Float64})
   @ FiniteDifferences ~/.julia/packages/FiniteDifferences/8zye5/src/methods.jl:249
 [2] (::FiniteDifferences.AdaptedFiniteDifferenceMethod{5, 1, FiniteDifferences.UnadaptedFiniteDifferenceMethod{7, 5}})(f::typeof(f), x::Float64, step::Measurement{Float64})
   @ FiniteDifferences ~/.julia/packages/FiniteDifferences/8zye5/src/methods.jl:240
 [3] (::FiniteDifferences.AdaptedFiniteDifferenceMethod{5, 1, FiniteDifferences.UnadaptedFiniteDifferenceMethod{7, 5}})(f::typeof(f), x::Float64)
   @ FiniteDifferences ~/.julia/packages/FiniteDifferences/8zye5/src/methods.jl:194
 [4] top-level scope
   @ In[6]:7
 [5] eval
   @ ./boot.jl:368 [inlined]
 [6] include_string(mapexpr::typeof(REPL.softscope), mod::Module, code::String, filename::String)
   @ Base ./loading.jl:1428

lstagner avatar Dec 20 '22 11:12 lstagner