diff --git a/base/operators.jl b/base/operators.jl index 992a5e4c9b52e..be867e93fc65b 100644 --- a/base/operators.jl +++ b/base/operators.jl @@ -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 diff --git a/base/reduce.jl b/base/reduce.jl index 1dbb1f2d54e9d..a3c8099b979a5 100644 --- a/base/reduce.jl +++ b/base/reduce.jl @@ -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 @@ -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 @@ -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) @@ -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)