Skip to content

Commit d357955

Browse files
Merge pull request #19949 from Sacha0/depisimag
deprecate isimag
2 parents 29a3563 + 197aca9 commit d357955

File tree

5 files changed

+6
-11
lines changed

5 files changed

+6
-11
lines changed

base/complex.jl

-6
Original file line numberDiff line numberDiff line change
@@ -90,12 +90,6 @@ false
9090
"""
9191
isreal(x::Real) = true
9292
isreal(z::Complex) = iszero(imag(z))
93-
"""
94-
isimag(z) -> Bool
95-
96-
Test whether `z` is purely imaginary, i.e. has a real part equal to 0.
97-
"""
98-
isimag(z::Number) = iszero(real(z))
9993
isinteger(z::Complex) = isreal(z) & isinteger(real(z))
10094
isfinite(z::Complex) = isfinite(real(z)) & isfinite(imag(z))
10195
isnan(z::Complex) = isnan(real(z)) | isnan(imag(z))

base/deprecated.jl

+3
Original file line numberDiff line numberDiff line change
@@ -1278,6 +1278,9 @@ eval(SparseArrays, :(broadcast_zpreserving!(f, C::SparseMatrixCSC, A::Union{Arra
12781278
@deprecate getindex(t::Tuple, r::AbstractArray) getindex(t, vec(r))
12791279
@deprecate getindex(t::Tuple, b::AbstractArray{Bool}) getindex(t, vec(b))
12801280

1281+
# Deprecate isimag (#19947).
1282+
@deprecate isimag(z::Number) iszero(real(z))
1283+
12811284
@deprecate airy(z::Number) airyai(z)
12821285
@deprecate airyx(z::Number) airyaix(z)
12831286
@deprecate airyprime(z::Number) airyaiprime(z)

base/exports.jl

-1
Original file line numberDiff line numberDiff line change
@@ -358,7 +358,6 @@ export
358358
ispow2,
359359
isqrt,
360360
isreal,
361-
isimag,
362361
issubnormal,
363362
iszero,
364363
lcm,

doc/src/stdlib/numbers.md

-1
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,6 @@ Base.nextfloat
7272
Base.prevfloat
7373
Base.isinteger
7474
Base.isreal
75-
Base.isimag
7675
Core.Float32
7776
Core.Float64
7877
Base.GMP.BigInt

test/complex.jl

+3-3
Original file line numberDiff line numberDiff line change
@@ -147,9 +147,9 @@ end
147147
end
148148
end
149149

150-
@testset "isimag and isinf" begin
151-
@test isimag(complex(0.0,1.0))
152-
@test !isimag(complex(1.0,1.0))
150+
@testset "isinf" begin
151+
@test iszero(real(complex(0.0,1.0))) # isimag deprecated
152+
@test !iszero(real(complex(1.0,1.0))) # isimag deprecated
153153
@test isinf(complex(Inf,0))
154154
@test isinf(complex(-Inf,0))
155155
@test isinf(complex(0,Inf))

0 commit comments

Comments
 (0)