Re: [julia-users] Trait for exactness of numbers

2016-10-25 Thread Mauro
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}

[julia-users] Trait for exactness of numbers

2016-10-24 Thread jw3126
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