Skip to content

Commit 1223c92

Browse files
author
oscarddssmith
committed
fix typo
1 parent 6b434d2 commit 1223c92

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

base/complex.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -351,7 +351,7 @@ function /(a::Complex{T}, b::Complex{T}) where T<:Real
351351
if isfinite(a)
352352
return complex(zero(T)*sign(are)*sign(bre), -zero(T)*sign(aim)*sign(bim))
353353
end
354-
return T(Nan+NaN*im)
354+
return T(NaN)+T(NaN)*im
355355
end
356356
if abs(bre) <= abs(bim)
357357
r = bre / bim
@@ -371,7 +371,7 @@ function /(z::Complex{T}, w::Complex{T}) where {T<:Union{Float16,Float32}}
371371
if isfinite(z)
372372
return complex(zero(T)*sign(a)*sign(c), -zero(T)*sign(b)*sign(d))
373373
end
374-
return T(Nan+NaN*im)
374+
return T(NaN)+T(NaN)*im
375375
end
376376
mag = inv(muladd(c, c, d^2))
377377
re_part = muladd(a, c, b*d)
@@ -393,7 +393,7 @@ function /(z::ComplexF64, w::ComplexF64)
393393
if isfinite(z)
394394
return complex(0.0*sign(a)*sign(c), -0.0*sign(b)*sign(d))
395395
end
396-
return Nan+NaN*im
396+
return NaN+NaN*im
397397
end
398398
halfov = 0.5*floatmax(Float64) # overflow threshold
399399
twounϵ = floatmin(Float64)*2.0/eps(Float64) # underflow threshold

test/complex.jl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1090,6 +1090,8 @@ end
10901090
# divide complex by complex Inf
10911091
@test isequal(complex(one(T)) / complex(T(Inf), T(-Inf)), complex(zero(T), zero(T)))
10921092
@test isequal(complex(one(T)) / complex(T(-Inf), T(Inf)), complex(-zero(T), -zero(T)))
1093+
@test isequal(complex(T(Inf)) / complex(T(Inf), T(-Inf)), complex(T(NaN), T(NaN)))
1094+
@test isequal(complex(T(NaN)) / complex(T(-Inf), T(Inf)), complex(T(NaN), T(NaN)))
10931095
end
10941096
end
10951097

0 commit comments

Comments
 (0)