From 27ed4aa138248c94f99e3a174c5ad1822aa26153 Mon Sep 17 00:00:00 2001 From: Alexander Plavin Date: Wed, 14 Feb 2024 18:35:00 -0500 Subject: [PATCH] min/maximum(abs) --- src/IntervalSets.jl | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/IntervalSets.jl b/src/IntervalSets.jl index b7374aa..12def60 100644 --- a/src/IntervalSets.jl +++ b/src/IntervalSets.jl @@ -337,6 +337,12 @@ maximum(d::TypedEndpointsInterval{L,:open}) where L = throw(ArgumentError("$d is extrema(I::TypedEndpointsInterval) = (infimum(I), supremum(I)) +minimum(::typeof(abs), I::TypedEndpointsInterval{:closed,:closed}) = + minimum(I) < 0 < maximum(I) ? + zero(minimum(I)) : + minimum(abs, endpoints(I)) +maximum(::typeof(abs), I::TypedEndpointsInterval{:closed,:closed}) = maximum(abs, endpoints(I)) + # Open and closed at endpoints isleftclosed(d::TypedEndpointsInterval{:closed}) = true isleftclosed(d::TypedEndpointsInterval{:open}) = false