diff --git a/base/math.jl b/base/math.jl index bf3895e401e44..650fc6bc0cef0 100644 --- a/base/math.jl +++ b/base/math.jl @@ -831,13 +831,11 @@ min(x::T, y::T) where {T<:AbstractFloat} = isnan(x) || ~isnan(y) && _isless(x, y max(x::T, y::T) where {T<:AbstractFloat} = isnan(x) || ~isnan(y) && _isless(y, x) ? x : y minmax(x::T, y::T) where {T<:AbstractFloat} = min(x, y), max(x, y) -_isless(x::Float16, y::Float16) = signbit(widen(x) - widen(y)) - -function min(x::T, y::T) where {T<:Union{Float16,Float32,Float64}} +function min(x::T, y::T) where {T<:IEEEFloat} return min_float(x, y) end -function max(x::T, y::T) where {T<:Union{Float16,Float32,Float64}} +function max(x::T, y::T) where {T<:IEEEFloat} return max_float(x, y) end diff --git a/src/runtime_intrinsics.c b/src/runtime_intrinsics.c index 33f823fe6d088..1790b9bd8d106 100644 --- a/src/runtime_intrinsics.c +++ b/src/runtime_intrinsics.c @@ -1404,7 +1404,7 @@ bi_fintrinsic(sub,sub_float) bi_fintrinsic(mul,mul_float) bi_fintrinsic(div,div_float) -float min_float(float x, float y) +float min_float(float x, float y) JL_NOTSAFEPOINT { float diff = x - y; float argmin = signbit(diff) ? x : y; @@ -1412,7 +1412,7 @@ float min_float(float x, float y) return is_nan ? diff : argmin; } -double min_double(double x, double y) +double min_double(double x, double y) JL_NOTSAFEPOINT { double diff = x - y; double argmin = signbit(diff) ? x : y; @@ -1423,7 +1423,7 @@ double min_double(double x, double y) #define _min(a, b) sizeof(a) == sizeof(float) ? min_float(a, b) : min_double(a, b) bi_fintrinsic(_min, min_float) -float max_float(float x, float y) +float max_float(float x, float y) JL_NOTSAFEPOINT { float diff = x - y; float argmin = signbit(diff) ? y : x; @@ -1431,7 +1431,7 @@ float max_float(float x, float y) return is_nan ? diff : argmin; } -double max_double(double x, double y) +double max_double(double x, double y) JL_NOTSAFEPOINT { double diff = x - y; double argmin = signbit(diff) ? x : y;