One solution could be to specialize this method on the many different combinations of Complex{<:Rational}, Complex{<:Integer}, Rational, Integer, and Number for the inputs, and check for overflow when doing any Integer math. Maybe there is a nicer way to fix this issue.
The current method for
//
onInteger
andComplex{<:Integer}
can overflow, silently giving an incorrect answer. For example:The expected answer is
0//1 - 2//25*im
The issue is caused by
abs2
andconj
onComplex{Int8}
silently overflowing in: https://github.com/JuliaLang/julia/blob/ccba6c91e24ebc0940acc2f8c390e6391ce0e292/base/rational.jl#L101One solution could be to specialize this method on the many different combinations of
Complex{<:Rational}
,Complex{<:Integer}
,Rational
,Integer
, andNumber
for the inputs, and check for overflow when doing anyInteger
math. Maybe there is a nicer way to fix this issue.