Skip to content

Commit e1d5268

Browse files
committed
Make inv(::ComplexF64) return zero when input has Inf magnitude
1 parent 7a75753 commit e1d5268

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

base/complex.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -433,6 +433,7 @@ function inv(w::ComplexF64)
433433
half = 0.5
434434
two = 2.0
435435
cd = max(abs(c), abs(d))
436+
(isinf(c) || isinf(d)) && return complex(copysign(0.0, c), flipsign(-0.0, d))
436437
ov = floatmax(c)
437438
un = floatmin(c)
438439
ϵ = eps(Float64)

0 commit comments

Comments
 (0)