diff --git a/base/abstractarraymath.jl b/base/abstractarraymath.jl index 6580333dd0a65..7ac606f9724d5 100644 --- a/base/abstractarraymath.jl +++ b/base/abstractarraymath.jl @@ -2,11 +2,10 @@ ## Basic functions ## -isinteger(x::AbstractArray) = all(isinteger,x) -isinteger{T<:Integer,n}(x::AbstractArray{T,n}) = true isreal(x::AbstractArray) = all(isreal,x) iszero(x::AbstractArray) = all(iszero,x) isreal{T<:Real,n}(x::AbstractArray{T,n}) = true +all{T<:Integer}(::typeof(isinteger), ::AbstractArray{T}) = true ctranspose(a::AbstractArray) = error("ctranspose not implemented for $(typeof(a)). Consider adding parentheses, e.g. A*(B*C') instead of A*B*C' to avoid explicit calculation of the transposed matrix.") transpose(a::AbstractArray) = error("transpose not implemented for $(typeof(a)). Consider adding parentheses, e.g. A*(B*C.') instead of A*B*C' to avoid explicit calculation of the transposed matrix.") diff --git a/base/deprecated.jl b/base/deprecated.jl index a93744db4b5bd..6d415af9ba086 100644 --- a/base/deprecated.jl +++ b/base/deprecated.jl @@ -1507,6 +1507,9 @@ function frexp{T<:AbstractFloat}(A::Array{T}) return (F, E) end +# Deprecate reducing isinteger over arrays +@deprecate isinteger(A::AbstractArray) all(isinteger, A) + # Deprecate promote_eltype_op (#19814, #19937) _promote_eltype_op(::Any) = Any _promote_eltype_op(op, A) = (@_inline_meta; promote_op(op, eltype(A))) diff --git a/base/number.jl b/base/number.jl index 8d5efb5ce7c33..4282d1b626237 100644 --- a/base/number.jl +++ b/base/number.jl @@ -4,14 +4,11 @@ """ isinteger(x) -> Bool -Test whether `x` or all its elements are numerically equal to some integer. +Test whether `x` is numerically equal to some integer. ```jldoctest julia> isinteger(4.0) true - -julia> isinteger([1; 2; 5.5]) -false ``` """ isinteger(x::Integer) = true diff --git a/test/abstractarray.jl b/test/abstractarray.jl index 2beb33da6895b..9e4de03aa0351 100644 --- a/test/abstractarray.jl +++ b/test/abstractarray.jl @@ -747,7 +747,7 @@ let end # isinteger and isreal -@test isinteger(Diagonal(rand(1:5,5))) +@test all(isinteger, Diagonal(rand(1:5, 5))) # reducing isinteger(...) deprecated @test isreal(Diagonal(rand(5))) # unary ops diff --git a/test/arrayops.jl b/test/arrayops.jl index b2cd9fb77b861..d6e3c578a85d8 100644 --- a/test/arrayops.jl +++ b/test/arrayops.jl @@ -277,7 +277,7 @@ end X = get(A, -5:5, NaN32) @test eltype(X) == Float32 @test Base.elsize(X) == sizeof(Float32) - @test !isinteger(X) + @test !all(isinteger, X) @test isnan.(X) == [trues(6);falses(5)] @test X[7:11] == [1:5;] X = get(A, (2:4, 9:-2:-13), 0)