Skip to content

Commit

Permalink
Add isunorded docstring and compat admonitions
Browse files Browse the repository at this point in the history
  • Loading branch information
cmcaine committed Dec 17, 2020
1 parent abf1be4 commit 925a365
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
9 changes: 9 additions & 0 deletions base/operators.jl
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,15 @@ largest values and `isgreater` defines a descending total order with `NaN` and
This is unexported. Types should not usually implement this function. Instead, implement `isless`.
"""
isgreater(x, y) = isunordered(x) || isunordered(y) ? isless(x, y) : isless(y, x)

"""
isunordered(x)
Return true if `x` is a value that is not normally orderable, such as `NaN` or `missing`.
!!! compat "Julia 1.7"
This method requires Julia 1.7 or later.
"""
isunordered(x) = false
isunordered(x::AbstractFloat) = isnan(x)
isunordered(x::Missing) = true
Expand Down
12 changes: 12 additions & 0 deletions base/reduce.jl
Original file line number Diff line number Diff line change
Expand Up @@ -775,6 +775,9 @@ are multiple maximal points, then the first one will be returned.
Values are compared with `isless`.
!!! compat "Julia 1.7"
This method requires Julia 1.7 or later.
# Examples
```jldoctest
Expand Down Expand Up @@ -828,6 +831,9 @@ are multiple minimal points, then the first one will be returned.
`NaN` is treated as less than all other values except `missing`.
!!! compat "Julia 1.7"
This method requires Julia 1.7 or later.
# Examples
```jldoctest
Expand Down Expand Up @@ -881,6 +887,9 @@ If there are multiple maximal values for `f(x)` then the first one will be found
Values are compared with `isless`.
!!! compat "Julia 1.7"
This method requires Julia 1.7 or later.
# Examples
```jldoctest
julia> argmax(abs, -10:5)
Expand Down Expand Up @@ -926,6 +935,9 @@ If there are multiple minimal values for `f(x)` then the first one will be found
`NaN` is treated as less than all other values except `missing`.
!!! compat "Julia 1.7"
This method requires Julia 1.7 or later.
# Examples
```jldoctest
julia> argmin(sign, -10:5)
Expand Down

0 comments on commit 925a365

Please sign in to comment.