Interestingly if to calculate determinant manually there's no issue whatsoever in this method:
typealias Num = Double
typealias V2 = simd_double2
typealias V3 = simd_double3
typealias V4 = simd_double4
typealias M22 = simd_double2x2
typealias M33 = simd_double3x3
typealias M44 = simd_double4x4
extension M22 {
var det: Num {
let c = columns
return c.0.x * c.1.y - c.0.y * c.1.x
}
}
extension M33 {
var det: Num {
let c = columns
return c.0.x * M22(V2(c.1.y, c.1.z), V2(c.2.y, c.2.z)).det -
c.1.x * M22(V2(c.0.y, c.0.z), V2(c.2.y, c.2.z)).det
}
}
extension M44 {
var det: Num {
let c = columns
return c.0.x * M33(V3(c.1.y, c.1.z, c.1.w), V3(c.2.y, c.2.z, c.2.w), V3(c.3.y, c.3.z, c.3.w)).det -
c.1.x * M33(V3(c.0.y, c.0.z, c.0.w), V3(c.2.y, c.2.z, c.2.w), V3(c.3.y, c.3.z, c.3.w)).det +
c.2.x * M33(V3(c.0.y, c.0.z, c.0.w), V3(c.1.y, c.1.z, c.1.w), V3(c.3.y, c.3.z, c.3.w)).det -
c.3.x * M33(V3(c.0.y, c.0.z, c.0.w), V3(c.1.y, c.1.z, c.1.w), V3(c.2.y, c.2.z, c.2.w)).det
}
}
let x = M44(
V4(+10732176.0, +0.0, 0.0, -17579304288.0),
V4(+0.0, +0.0, +112710780.0, -184620257640.0),
V4(-107344692.0, -112710780.0, -112710780.0, +175830605496.0),
V4(+0.0, +0.0, +10732176.0, -17579304288.0)
).det
print(x) // 0.0
Perhaps built-in determinant is using a different method (e.g. one that uses division and suffers when both numerator and denominator are both close to zero).