I’m trying to figure out why the type of this function is not predictable
function η_const(r, η_)
if r>=1
return convert( typeof(r), 0.0)
elseif r<=0.8
return convert( typeof(r), 1.0)
else
return convert( typeof(r), η_((r -0.8)/0.2) )
end
end
f(r) = quadgk( x-> bump(x, β), -1, (1-2*r^2), rtol=1e-9)[1]
η_ = Fun( x->f(x) , 0..1)
η(r) = η_const(r, η_)
If I check
@code_warntype η(0.5)
MethodInstance for η(::Float64)
from η(r) in Main at /Users/Veenty/Documents/NYU PhD/Flatiron Institute Research /Spindle_ODE/benchmark_time.jl:50
Arguments
#self#::Core.Const(η)
r::Float64
Body::Any
1 ─ %1 = Main.η_const(r, Main.η_)::Any
└── return %1
Which does not make sense to me, I would expect for the output to be Float64