diff --git a/README.md b/README.md index db55f2da4..93777c6fe 100644 --- a/README.md +++ b/README.md @@ -238,6 +238,9 @@ Currently, the `@compat` macro supports the following syntaxes: * `strwidth` and `charwidth` are now merged into `textwidth` ([#23667]). +* `Complex32`, `Complex64`, and `Complex128` are now `ComplexF16`, `ComplexF32`, and + `ComplexF64`, respectively ([#24647]). + ## New macros * `@__DIR__` has been added ([#18380]) @@ -382,6 +385,7 @@ includes this fix. Find the minimum version from there. [#24372]: https://github.com/JuliaLang/julia/issues/24372 [#24459]: https://github.com/JuliaLang/julia/issues/24459 [#24605]: https://github.com/JuliaLang/julia/issues/24605 +[#24647]: https://github.com/JuliaLang/julia/issues/24647 [#24652]: https://github.com/JuliaLang/julia/issues/24652 [#24657]: https://github.com/JuliaLang/julia/issues/24657 [#24785]: https://github.com/JuliaLang/julia/issues/24785 diff --git a/src/Compat.jl b/src/Compat.jl index 4afa8dddb..3cd332ef6 100644 --- a/src/Compat.jl +++ b/src/Compat.jl @@ -860,6 +860,20 @@ if VERSION < v"0.7.0-DEV.1499" end end +# 0.7.0-DEV.2919 +@static if !isdefined(Base, :ComplexF16) + const ComplexF16 = Complex{Float16} + export ComplexF16 +end +@static if !isdefined(Base, :ComplexF32) + const ComplexF32 = Complex{Float32} + export ComplexF32 +end +@static if !isdefined(Base, :ComplexF64) + const ComplexF64 = Complex{Float64} + export ComplexF64 +end + include("deprecated.jl") end # module Compat diff --git a/test/runtests.jl b/test/runtests.jl index d9447c170..51700611b 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -616,8 +616,8 @@ end let zbuf = IOBuffer([0xbf, 0xc0, 0x00, 0x00, 0x40, 0x20, 0x00, 0x00, 0x40, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x12, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]) - z1 = read(zbuf, Complex64) - z2 = read(zbuf, Complex128) + z1 = read(zbuf, ComplexF32) + z2 = read(zbuf, ComplexF64) @test bswap(z1) === -1.5f0 + 2.5f0im @test bswap(z2) === 3.5 - 4.5im end @@ -701,7 +701,7 @@ end @test logdet(0.5) == log(det(0.5)) # PR 22633 -for T in (Float64, Complex64, BigFloat, Int) +for T in (Float64, ComplexF32, BigFloat, Int) λ = T(4) @test chol(λ*I).λ ≈ √λ @test_throws Union{ArgumentError,LinAlg.PosDefException} chol(-λ*I) @@ -909,7 +909,7 @@ let a = [1 0 0; 0 1 0; 0 0 1] @test SparseMatrixCSC{Int}(I, 3, 3)::SparseMatrixCSC{Int,Int} == a @test SparseMatrixCSC{Float64}(I, (3, 2))::SparseMatrixCSC{Float64,Int} == a[:,1:2] @test SparseMatrixCSC{Bool,Int16}(I, (3, 3))::SparseMatrixCSC{Bool,Int16} == a - @test SparseMatrixCSC{Complex128,Int8}(I, 3, 2)::SparseMatrixCSC{Complex128,Int8} == a[:,1:2] + @test SparseMatrixCSC{ComplexF64,Int8}(I, 3, 2)::SparseMatrixCSC{ComplexF64,Int8} == a[:,1:2] end # 0.7.0-DEV.2581 @@ -952,6 +952,11 @@ let key = "TEST_23412" @test get(() -> "default", ENV, key) == "default" end +# 0.7.0-DEV.2919 +@test ComplexF16 === Complex{Float16} +@test ComplexF32 === Complex{Float32} +@test ComplexF64 === Complex{Float64} + if VERSION < v"0.6.0" include("deprecated.jl") end