-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
Closed
Labels
Description
In Julia 0.4–0.7, I get:
julia> (Inf + Inf*im)^2.0
0.0 + Inf*im
which seems wrong (it assumes that the two Inf
components are the "same"). The correct answer is given for ^2
:
julia> (Inf + Inf*im)^2
NaN + Inf*im
The error seems to be due to this line, which dates back to #2891 by @jiahao.
My first inclination is to remove the entire p==2
special case from this ^
method. As I commented in #24497, that seems to be a performance optimization that is probably largely superseded, since most cases that need a fast z^2
probably use (a) an integer exponent (that calls a different method) and/or (b) a literal integer exponent (for which z^2
is inlined as z*z
for Complex64
and Complex128
).