You can write this as
function f3(x::Bool, y::T) where T<:AbstractFloat
ifelse(x | iszero(y), one(T), abs(y) * T(Inf) * (!(y>0)))
end
which on my computer benchmarks a bit faster.
You can write this as
function f3(x::Bool, y::T) where T<:AbstractFloat
ifelse(x | iszero(y), one(T), abs(y) * T(Inf) * (!(y>0)))
end
which on my computer benchmarks a bit faster.