Skip to content

Commit

Permalink
Add tests for complex division corner cases, issue JuliaLang#22983 (J…
Browse files Browse the repository at this point in the history
  • Loading branch information
giordano authored and StefanKarpinski committed Aug 1, 2017
1 parent 738d042 commit 9b397fa
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions test/complex.jl
Original file line number Diff line number Diff line change
Expand Up @@ -974,3 +974,16 @@ end
" 1.0e-15+2.0im ",
" 1.0+2.0e-15im"], "\n")
end

@testset "corner cases of division, issue #22983" begin
# These results abide by ISO/IEC 10967-3:2006(E) and
# mathematical definition of division of complex numbers.
for T in (Float32, Float64, BigFloat)
@test isequal(one(T) / zero(Complex{T}), one(Complex{T}) / zero(Complex{T}))
@test isequal(one(T) / zero(Complex{T}), Complex{T}(NaN, NaN))
@test isequal(one(Complex{T}) / zero(T), Complex{T}(Inf, NaN))
@test isequal(one(Complex{T}) / one(Complex{T}), one(Complex{T}))
@test isequal(one(T) / complex(one(T), zero(T)), Complex(one(T), -zero(T)))
@test isequal(one(T) / complex(one(T), -zero(T)), Complex(one(T), zero(T)))
end
end

0 comments on commit 9b397fa

Please sign in to comment.