diff --git a/src/Approximations/box_approximation.jl b/src/Approximations/box_approximation.jl index 3af7ed161a..e7f372bec7 100644 --- a/src/Approximations/box_approximation.jl +++ b/src/Approximations/box_approximation.jl @@ -54,6 +54,9 @@ function box_approximation(S::LazySet{N}) where {N} r = Vector{N}(undef, n) @inbounds for i in 1:n lo, hi = extrema(S, i) + if isinf(lo) || isinf(hi) + throw(ArgumentError("the box approximation of an unbounded set is undefined")) + end ri = (hi - lo) / 2 if ri < zero(N) if !_geq(ri, zero(N)) diff --git a/test/Sets/Line.jl b/test/Sets/Line.jl index a245e9e0f1..004161e92e 100644 --- a/test/Sets/Line.jl +++ b/test/Sets/Line.jl @@ -46,6 +46,9 @@ for N in [Float64, Rational{Int}, Float32] # boundedness @test !isbounded(l1) + # box_approximation + @test_throws ArgumentError box_approximation(l1) + # ispolyhedral @test ispolyhedral(l1)