You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As discussed in #5112, inv(1e300+0im) gives 0.0 - 0.0im rather than 1e-300 - 0.0im. The problem is that the definition inv(z::Complex) = conj(z)/abs2(z) is not robust to overflows.
The right thing is probably:
Use a specialized version of the robust division algorithm to compute 1.0/z for Complex{Float64}, or maybe specialize it for /(r::Float64, z::Complex{Float64}) if that is faster than r*inv(z) (I'm guessing not). (Just take the existing complex-division algorithm and simplify it for the case of a real numerator 1.0.)
Use the naive algorithm with Float64 arithmetic for Complex{Float32} and Complex{Integer} types where there is no possibility of Float64 overflow.
Continue to use the naive algorithm for BigFloat.
(Similarly for complex division in general.)
The text was updated successfully, but these errors were encountered:
As discussed in #5112,
inv(1e300+0im)
gives0.0 - 0.0im
rather than1e-300 - 0.0im
. The problem is that the definitioninv(z::Complex) = conj(z)/abs2(z)
is not robust to overflows.The right thing is probably:
1.0/z
forComplex{Float64}
, or maybe specialize it for/(r::Float64, z::Complex{Float64})
if that is faster thanr*inv(z)
(I'm guessing not). (Just take the existing complex-division algorithm and simplify it for the case of a real numerator 1.0.)Float64
arithmetic forComplex{Float32}
andComplex{Integer}
types where there is no possibility ofFloat64
overflow.BigFloat
.(Similarly for complex division in general.)
The text was updated successfully, but these errors were encountered: