# Weird Behaviour/Bug in Polyhedra.jl

**URL:** https://discourse.julialang.org/t/weird-behaviour-bug-in-polyhedra-jl/74168
**Category:** Optimization (Mathematical)
**Tags:** question, bug, polyhedra
**Created:** [January 6, 2022, 11:30pm UTC](https://discourse.julialang.org/t/weird-behaviour-bug-in-polyhedra-jl/74168 "2022-01-06T23:30:01Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![Codzilla](https://avatars.discourse-cdn.com/v4/letter/c/7cd45c/32.png) [@Codzilla](https://discourse.julialang.org/u/Codzilla)
#### Post date: [January 6, 2022, 11:30pm UTC](https://discourse.julialang.org/t/weird-behaviour-bug-in-polyhedra-jl/74168/1 "2022-01-06T23:30:01Z")

</div>

I observed a strange behaviour with Polyhedra.jl. As a result of a rather complicated algorithm, I obtained a polyhedron as an intersection of half-planes. However, when I want to compute the vertices forming the complex hull, I get an empty set even though the polyhedron is not empty.

```julia
    verticesPoly = collect(points(doubledescription(poly)))
    println("vertices Poly ", verticesPoly) 
    println(poly)
    println(doubledescription(poly))
    println("The poly is ","not"^(!isempty(polyhedron(poly, CDDLib.Library(:float)))), " empty ")

```

Which gives the following output

```julia
vertices Poly Vector{Float64}[]
HalfSpace([-2.7574372873656063, -1.0], -0.36977619761786795) ∩ HalfSpace([2.7574372873656063, 1.0], 0.37977619761786796) ∩ HalfSpace([-2.847841082745452, -1.0], -0.28454512417330524) ∩ HalfSpace([2.847841082745452, 1.0], 0.29454512417330525) ∩ HalfSpace([-2.9382448781252974, -1.0], -0.1969492542069525) ∩ HalfSpace([2.9382448781252974, 1.0], 0.2069492542069525) ∩ HalfSpace([-3.028648673505143, -1.0], -0.10770400784273976) ∩ HalfSpace([3.028648673505143, 1.0], 0.11770400784273977) ∩ HalfSpace([-3.119052468884989, -1.0], -0.017538276125857677) ∩ HalfSpace([3.119052468884989, 1.0], 0.02753827612585768) ∩ HalfSpace([-3.2094562642648348, -1.0], 0.07281153203555704) ∩ HalfSpace([3.2094562642648348, 1.0], -0.06281153203555703) ∩ HalfSpace([-3.29986005964468, -1.0], 0.1626075043292363) ∩ HalfSpace([3.29986005964468, 1.0], -0.15260750432923628) ∩ HalfSpace([-3.390263855024526, -1.0], 0.2511162517763226) ∩ HalfSpace([3.390263855024526, 1.0], -0.2411162517763226) ∩ HalfSpace([-3.4806676504043716, -1.0], 0.33761489852556953) ∩ HalfSpace([3.4806676504043716, 1.0], -0.3276148985255695) ∩ HalfSpace([-3.571071445784217, -1.0], 0.42139698578387413) ∩ HalfSpace([3.571071445784217, 1.0], -0.4113969857838741) … 

The poly is not empty 

```

Am I doing something wrong? Whenever I run this code on other instances (outputted again by the rather complicated algorithm) this gives the expected behaviour.

---

<div class="post-metadata">

### Author: ![Codzilla](https://avatars.discourse-cdn.com/v4/letter/c/7cd45c/32.png) [@Codzilla](https://discourse.julialang.org/u/Codzilla)
#### Post date: [January 27, 2022, 1:27am UTC](https://discourse.julialang.org/t/weird-behaviour-bug-in-polyhedra-jl/74168/2 "2022-01-27T01:27:44Z")

</div>

Found it! It’s a precision issue. isempty can be called with more precision than float.

```julia
isempty(polyhedron(poly, CDDLib.Library(:exact))) 

```
