From 197aca97f1b64193e2d678e7e416266a77402e9b Mon Sep 17 00:00:00 2001 From: Sacha Verweij Date: Mon, 9 Jan 2017 10:57:21 -0800 Subject: [PATCH] Deprecate isimag. --- base/complex.jl | 6 ------ base/deprecated.jl | 3 +++ base/exports.jl | 1 - doc/src/stdlib/numbers.md | 1 - test/complex.jl | 6 +++--- 5 files changed, 6 insertions(+), 11 deletions(-) diff --git a/base/complex.jl b/base/complex.jl index 16cc55e87b342..9838f216060dd 100644 --- a/base/complex.jl +++ b/base/complex.jl @@ -90,12 +90,6 @@ false """ isreal(x::Real) = true isreal(z::Complex) = iszero(imag(z)) -""" - isimag(z) -> Bool - -Test whether `z` is purely imaginary, i.e. has a real part equal to 0. -""" -isimag(z::Number) = iszero(real(z)) isinteger(z::Complex) = isreal(z) & isinteger(real(z)) isfinite(z::Complex) = isfinite(real(z)) & isfinite(imag(z)) isnan(z::Complex) = isnan(real(z)) | isnan(imag(z)) diff --git a/base/deprecated.jl b/base/deprecated.jl index 773ec6ae95bfb..096fb21b2523c 100644 --- a/base/deprecated.jl +++ b/base/deprecated.jl @@ -1278,6 +1278,9 @@ eval(SparseArrays, :(broadcast_zpreserving!(f, C::SparseMatrixCSC, A::Union{Arra @deprecate getindex(t::Tuple, r::AbstractArray) getindex(t, vec(r)) @deprecate getindex(t::Tuple, b::AbstractArray{Bool}) getindex(t, vec(b)) +# Deprecate isimag (#19947). +@deprecate isimag(z::Number) iszero(real(z)) + @deprecate airy(z::Number) airyai(z) @deprecate airyx(z::Number) airyaix(z) @deprecate airyprime(z::Number) airyaiprime(z) diff --git a/base/exports.jl b/base/exports.jl index 0020e1120482e..5321c087627fb 100644 --- a/base/exports.jl +++ b/base/exports.jl @@ -358,7 +358,6 @@ export ispow2, isqrt, isreal, - isimag, issubnormal, iszero, lcm, diff --git a/doc/src/stdlib/numbers.md b/doc/src/stdlib/numbers.md index 8a6508d0ae326..ffce0a45ac16f 100644 --- a/doc/src/stdlib/numbers.md +++ b/doc/src/stdlib/numbers.md @@ -72,7 +72,6 @@ Base.nextfloat Base.prevfloat Base.isinteger Base.isreal -Base.isimag Core.Float32 Core.Float64 Base.GMP.BigInt diff --git a/test/complex.jl b/test/complex.jl index bb9aa2d0e7a02..8bd7435457e74 100644 --- a/test/complex.jl +++ b/test/complex.jl @@ -147,9 +147,9 @@ end end end -@testset "isimag and isinf" begin - @test isimag(complex(0.0,1.0)) - @test !isimag(complex(1.0,1.0)) +@testset "isinf" begin + @test iszero(real(complex(0.0,1.0))) # isimag deprecated + @test !iszero(real(complex(1.0,1.0))) # isimag deprecated @test isinf(complex(Inf,0)) @test isinf(complex(-Inf,0)) @test isinf(complex(0,Inf))