From 1dbfb3f3a0831e6c5f399c34b86faca4790dc40d Mon Sep 17 00:00:00 2001 From: Milan Bouchet-Valat Date: Sun, 3 Jul 2016 22:55:57 +0200 Subject: [PATCH] More efficient conversion in ^(::Complex, ::Complex) (#17259) This can avoid a costly allocation of e.g. BigInt(2). --- base/complex.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/base/complex.jl b/base/complex.jl index 07e004b3519cf..afd39316cad6f 100644 --- a/base/complex.jl +++ b/base/complex.jl @@ -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)