Skip to content

Commit

Permalink
More efficient conversion in ^(::Complex, ::Complex) (JuliaLang#17259)
Browse files Browse the repository at this point in the history
This can avoid a costly allocation of e.g. BigInt(2).
  • Loading branch information
nalimilan authored and mfasi committed Sep 5, 2016
1 parent 4a021a8 commit 1dbfb3f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion base/complex.jl
Original file line number Diff line number Diff line change
Expand Up @@ -450,7 +450,7 @@ function ^{T<:AbstractFloat}(z::Complex{T}, p::Complex{T})
if p==2 #square
zr, zi = reim(z)
x = (zr-zi)*(zr+zi)
y = T(2)*zr*zi
y = T(2*zr*zi)
if isnan(x)
if isinf(y)
x = copysign(zero(T),zr)
Expand Down

0 comments on commit 1dbfb3f

Please sign in to comment.