Another possibility that occurs to me is to redefine the == equality
comparison. Currently this is defined as

==(z::Complex, w::Complex) = (real(z) == real(w)) & (imag(z) == imag(w))

but for some purposes it may be sufficient to redefine this as

==(z::Complex, w::Complex) = if isinf(z) && isinf(w)
    return true
else
    return (real(z) == real(w)) & (imag(z) == imag(w))
end

to model the topology of the Riemann sphere.

With this redefinition:

julia> Complex(Inf, 0.0) == Complex(Inf, NaN)
true

julia> Complex(Inf, 0.0) == Complex(Inf, 2.0)
true

Reply via email to