What is the correct, generic way to figure out if values of a type
T can be converted into another type
S without loss of precision?
Base.typejoin cannot be used for this (eg for
(Int8, Int16), it returns
promote_type would allow
Float64, which is not always lossless.
I want something like
mypromote(Int8, Int64) == Int64 mypromote(Int32, Float64) == Float64 mypromote(Int64, Float64) == Real
but I wonder if I can implement it without a lot of special cases.