And here are additional "unfortunate" behaviors with complex arithmetic as currently implemented.
First, dividing nonzero by zero should give an infinite result. It does for real, but not complex: julia> 1/0 Inf julia> 1/(0+0*im) # Should be some form of infinity NaN + NaN*im Second: Dividing by infinity (expect inf/inf) should give 0, but this is inconsistent: julia> 1/Inf 0.0 julia> 1/(Inf*im) 0.0 - 0.0im julia> 1/(Inf+Inf*im) # should be complex zero NaN + NaN*im On Saturday, January 10, 2015 at 8:55:09 AM UTC-5, Ed Scheinerman wrote: > > Is there a way to have a single complex infinity? This may come at the > cost of computational efficiency I suppose, but I can think of situations > where all of the following give the same result: > > julia> (1+1im)/0 > Inf + Inf*im > > julia> 1im/0 > NaN + Inf*im > > julia> 1/0 + im > Inf + 1.0im > > It would be nice (sometimes) if these were all the same ComplexInf, say. > Perhaps there's an "extended complex numbers" module for this sort of work? >