gridap / gridap/MiniQhull.jl

Different results with `Float64` and `Float32`

Open
#31 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Julia
Stars
31
Forks
9
PR merge metrics
No merged PRs in 30d

Description

Below is a script to run the same input, first with `Float64` and then with `Float32`.

```julia
using MiniQhull

for N in (Float64, Float32)
vlist = [ # the 8 vertices of a cube centered in the origin
N[1, 1, 1]
N[-1, 1, 1]
N[1, -1, 1]
N[-1, -1, 1]
N[1, 1, -1]
N[-1, 1, -1]
N[1, -1, -1]
N[-1, -1, -1]
]
points = vcat(vlist...)
n = 3
m = 8
flags = "qhull Qt" # triangulation; http://www.qhull.org/html/qh-optq.htm#Qt

res = MiniQhull.delaunay(n, m, points, flags)
@show res
end
```

Output (the last rows are irrelevant and contain random values):

```julia
res = Int32[4 4 6 6 6 6 7 7 7 7 7 7; 3 1 1 5 4 4 3 5 4 4 6 6; 1 2 2 1 2 8 1 1 3 8 5 8; 0 0 0 0 0 0 0 0 0 0 0 0]
res = Int32[5 4 3 3 3 3; 1 5 1 4 5 4; 2 2 2 2 1 5; 0 0 0 0 0 0]
```

The `Float64` result is correct, while the `Float32` result is not. Is this expected? I could not find a difference in the Julia code, so this may be an issue in the C library, but I wanted to check here first.

EDIT: I also noticed that the `Float32` version may randomly crash.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.