Faster `min`,`max` for `Float64|32`

There doesn’t seem to be anything wrong with either min or max in isolation, but with minmax you force it do run both subtractions, while it seems like you can get away with changing either, e.g.:

function man(a::T, b::T) where {T<:FastFloat}
    a_b = a - b
    (signbit(a_b) | isnan(a)) ? b : a
end

doing away with one and the same subtraction, and fewer jumps/shorter assembly:

@code_native minmax(0.0, -0.0)
1 Like