55
66Complex number type with real and imaginary part of type `T`.
77
8- `Complex32 `, `Complex64 ` and `Complex128 ` are aliases for
8+ `ComplexF16 `, `ComplexF32 ` and `ComplexF64 ` are aliases for
99`Complex{Float16}`, `Complex{Float32}` and `Complex{Float64}` respectively.
1010"""
1111struct Complex{T<: Real } <: Number
@@ -28,9 +28,9 @@ julia> im * im
2828"""
2929const im = Complex (false , true )
3030
31- const Complex128 = Complex{Float64}
32- const Complex64 = Complex{Float32}
33- const Complex32 = Complex{Float16}
31+ const ComplexF64 = Complex{Float64}
32+ const ComplexF32 = Complex{Float32}
33+ const ComplexF16 = Complex{Float16}
3434
3535convert (:: Type{Complex{T}} , x:: Real ) where {T<: Real } = Complex {T} (x,0 )
3636convert (:: Type{Complex{T}} , z:: Complex ) where {T<: Real } = Complex {T} (real (z),imag (z))
@@ -353,7 +353,7 @@ inv(z::Complex{<:Union{Float16,Float32}}) =
353353# a + i*b
354354# p + i*q = ---------
355355# c + i*d
356- function / (z:: Complex128 , w:: Complex128 )
356+ function / (z:: ComplexF64 , w:: ComplexF64 )
357357 a, b = reim (z); c, d = reim (w)
358358 half = 0.5
359359 two = 2.0
@@ -369,7 +369,7 @@ function /(z::Complex128, w::Complex128)
369369 ab <= un* two/ ϵ && (a= a* bs; b= b* bs; s= s/ bs ) # scale up a,b
370370 cd <= un* two/ ϵ && (c= c* bs; d= d* bs; s= s* bs ) # scale up c,d
371371 abs (d)<= abs (c) ? ((p,q)= robust_cdiv1 (a,b,c,d) ) : ((p,q)= robust_cdiv1 (b,a,d,c); q= - q)
372- return Complex128 (p* s,q* s) # undo scaling
372+ return ComplexF64 (p* s,q* s) # undo scaling
373373end
374374function robust_cdiv1 (a:: Float64 , b:: Float64 , c:: Float64 , d:: Float64 )
375375 r = d/ c
@@ -387,7 +387,7 @@ function robust_cdiv2(a::Float64, b::Float64, c::Float64, d::Float64, r::Float64
387387 end
388388end
389389
390- function inv (w:: Complex128 )
390+ function inv (w:: ComplexF64 )
391391 c, d = reim (w)
392392 half = 0.5
393393 two = 2.0
@@ -411,7 +411,7 @@ function inv(w::Complex128)
411411 p = r * t
412412 q = - t
413413 end
414- return Complex128 (p* s,q* s) # undo scaling
414+ return ComplexF64 (p* s,q* s) # undo scaling
415415end
416416
417417function ssqs (x:: T , y:: T ) where T<: AbstractFloat
0 commit comments