Skip to content

Commit

Permalink
Review comments in JuliaLang#35792
Browse files Browse the repository at this point in the history
  • Loading branch information
simeonschaub authored and jmert committed Nov 15, 2020
1 parent 4f166b0 commit 3a6d7a0
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions base/complex.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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

"""
Expand Down

0 comments on commit 3a6d7a0

Please sign in to comment.