Skip to content

Commit 7be7ddb

Browse files
authored
Alias ispositive/isnegative in recent enough julia versions (#2091)
1 parent d76bdf0 commit 7be7ddb

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

src/Aliases.jl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,11 @@
1515
@alias is_zero iszero
1616
@alias number_of_digits ndigits
1717

18+
if VERSION >= v"1.13.0-DEV.534" # https://github.com/JuliaLang/julia/pull/53677
19+
@alias is_positive ispositive
20+
@alias is_negative isnegative
21+
end
22+
1823

1924
# alternative names for some functions from LinearAlgebra
2025
# we don't use the `@alias` macro here because we provide custom

src/julia/Float.jl

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,10 @@ canonical_unit(a::AbstractFloat) = iszero(a) ? copysign(one(a), a) : a
4444

4545
characteristic(a::Floats{T}) where T <: AbstractFloat = 0
4646

47-
is_negative(n::T) where T<:Real = n < zero(T)
48-
49-
is_positive(n::T) where T<:Real = n > zero(T)
47+
if VERSION < v"1.13.0-DEV.534" # https://github.com/JuliaLang/julia/pull/53677
48+
is_negative(n::T) where T<:Real = n < zero(T)
49+
is_positive(n::T) where T<:Real = n > zero(T)
50+
end
5051

5152
###############################################################################
5253
#

0 commit comments

Comments
 (0)