Suppose that for some calculation with floats, I want F to be at least as precise as S (in the sense of Float16 < Float32 < Float64 < ...), but I don’t want to determine how precise (it’s up to the user), other than “at least Float32”. So I could do
function g(S,F)
if S <: AbstractFloat && F <: AbstractFloat
_rank(f) = findfirst([Float16, Float32, Float64, BigFloat], f)
max(_rank(S),2) ≤ _rank(F)
else
false
end
end
and enforce this with the constructor.