I've been trying to do some 3D geometry things from this paper in Swift. Long story short, this requires calculating signs of determinants of 4x4 double-precision matrices. I've tried using simd_double4x4.determinant for this, to no avail - it returns wrong values.

For example, `simd_double4x4(simd_double4(10732176, 0, 0, -17579304288), simd_double4(0, 0, 112710780, -184620257640), simd_double4(-107344692, -112710780, -112710780, 175830605496), simd_double4(0, 0, 10732176, -17579304288)).determinant`

(the numbers can seem intimidating, but they all fit into Doubles exactly) returns something about 3.687e+17, however, it should be 0.

This happens on both Swift 5.7.1 and latest main trunk (DEVELOPMENT-SNAPSHOT-2023-02-23), on both macos 13.2.1 and iPhone iOS 16.2. The same story happens with simd_determinant, and it seems to affect other geometric predicates that could be internally implemented through determinant (like here).

- Is it really wrong, or I'm missing something?
- Does simd_double4x4.determinant guarantee precision to the ULP?
- Are there any good alternatives for calculating determinant of 4x4 double matrix with precision to the sign in Swift? Ideally, this also should be adaptive, as I'd imagine calculating the 4x4 determinant precisely would be quite expensive, and I'm only interested in its sign.

Sorry if this is outside of the scope of this forum.