Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 0 additions & 8 deletions base/reduce.jl
Original file line number Diff line number Diff line change
Expand Up @@ -860,14 +860,6 @@ ExtremaMap(::Type{T}) where {T} = ExtremaMap{Type{T}}(T)
@inline (f::ExtremaMap)(x) = (y = f.f(x); (y, y))

@inline _extrema_rf((min1, max1), (min2, max2)) = (min(min1, min2), max(max1, max2))
# optimization for IEEEFloat
function _extrema_rf(x::NTuple{2,T}, y::NTuple{2,T}) where {T<:IEEEFloat}
(x1, x2), (y1, y2) = x, y
anynan = isnan(x1)|isnan(y1)
z1 = ifelse(anynan, x1-y1, ifelse(signbit(x1-y1), x1, y1))
z2 = ifelse(anynan, x1-y1, ifelse(signbit(x2-y2), y2, x2))
z1, z2
end

## findmax, findmin, argmax & argmin

Expand Down
3 changes: 2 additions & 1 deletion test/numbers.jl
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,8 @@ end
x = unorded[i], unorded[i]
y = unorded[j], unorded[j]
z = Base._extrema_rf(x, y)
@test z === x || z === y
@test (z[1] === x[1] || z[1] === y[1]) &&
(z[2] === x[1] || z[2] === y[1])
end
end
end
Expand Down