Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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