Skip to content

Commit

Permalink
Merge pull request #19949 from Sacha0/depisimag
Browse files Browse the repository at this point in the history
deprecate isimag
  • Loading branch information
StefanKarpinski authored Jan 12, 2017
2 parents 29a3563 + 197aca9 commit d357955
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 11 deletions.
6 changes: 0 additions & 6 deletions base/complex.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down
3 changes: 3 additions & 0 deletions base/deprecated.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
1 change: 0 additions & 1 deletion base/exports.jl
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,6 @@ export
ispow2,
isqrt,
isreal,
isimag,
issubnormal,
iszero,
lcm,
Expand Down
1 change: 0 additions & 1 deletion doc/src/stdlib/numbers.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@ Base.nextfloat
Base.prevfloat
Base.isinteger
Base.isreal
Base.isimag
Core.Float32
Core.Float64
Base.GMP.BigInt
Expand Down
6 changes: 3 additions & 3 deletions test/complex.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down

0 comments on commit d357955

Please sign in to comment.