You can use SimpleTraits.jl for this:
using SimpleTraits
# Using Jeffrey's function, define good defaults:
function isexact{X}(::Type{X})
if X<:Integer || X<:Rational
true
elseif X<:Complex
isexact(real(X))
else
false
end
end
@traitdef IsExact{X}
@generate
A couple of times I was in a situation, where I had two algorithms solving
the same problem, one which was faster and one which was more numerically
stable. Now for some types of numbers (FloatingPoint, Complex{Float64}...)
numerical stability is important while for others it does not matter (e.