Skip to content

Commit

Permalink
Make exp(::Complex{Irrational}) work (JuliaLang#21596)
Browse files Browse the repository at this point in the history
Addresses JuliaLang#21204.
  • Loading branch information
giordano authored and tkelman committed Apr 29, 2017
1 parent 41376e2 commit a0c1429
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion base/complex.jl
Original file line number Diff line number Diff line change
Expand Up @@ -504,7 +504,7 @@ function exp(z::Complex)
end
else
er = exp(zr)
if zi == zero(zi)
if iszero(zi)
Complex(er, zi)
else
Complex(er*cos(zi), er*sin(zi))
Expand Down
7 changes: 7 additions & 0 deletions test/complex.jl
Original file line number Diff line number Diff line change
Expand Up @@ -943,3 +943,10 @@ end

# issue #19240
@test big(1)/(10+10im) (5-5im)/big(100) big"0.05" - big"0.05"*im

@testset "Complex Irrationals, issue #21204" begin
for x in (pi, e, catalan) # No need to test all of them
@test typeof(Complex(x, x)) == Complex{typeof(x)}
@test exp(complex(x, x)) exp(x) * cis(x)
end
end

0 comments on commit a0c1429

Please sign in to comment.