From 3a6d7a0fc5f9f91e64fe0b1f5924ee395473e888 Mon Sep 17 00:00:00 2001 From: Simeon Schaub Date: Tue, 23 Jun 2020 12:42:55 -0500 Subject: [PATCH] Review comments in #35792 --- base/complex.jl | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/base/complex.jl b/base/complex.jl index 8836995c44b55..2c42ece40da23 100644 --- a/base/complex.jl +++ b/base/complex.jl @@ -541,9 +541,7 @@ function cis(z::Complex) Complex(v * c, v * s) end -cispi(sign::Bool) = sign ? -1 : 1 -cispi(sign::Integer) = oftype(sign, cispi(isodd(sign))) -cispi(theta::Real) = Complex(cospi(theta), sinpi(theta)) +cispi(theta::Real) = Complex(reverse(sincospi(theta))...) """ cispi(z) @@ -572,7 +570,8 @@ true This function requires Julia 1.6 or later. """ function cispi(z::Complex) - cospi(z) + im*sinpi(z) + sipi, copi = sincospi(z) + return complex(real(copi) - imag(sipi), imag(copi) + real(sipi)) end """