# Determinants seem to be wrong with simd\_double4x4.determinant

**URL:** <https://forums.swift.org/t/determinants-seem-to-be-wrong-with-simd-double4x4-determinant/63366>\
**Category:** Using Swift\
**Tags:** simd, accelerate, geometry\
**Created:** [February 25, 2023, 11:59pm UTC](https://forums.swift.org/t/determinants-seem-to-be-wrong-with-simd-double4x4-determinant/63366 "2023-02-25T23:59:59Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![kunitsyn](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/kunitsyn/32/24587_2.png) [@kunitsyn](https://forums.swift.org/u/kunitsyn)\
**Post date:** [February 25, 2023, 11:59pm UTC](https://forums.swift.org/t/determinants-seem-to-be-wrong-with-simd-double4x4-determinant/63366/1 "2023-02-25T23:59:59Z")

</div>

I've been trying to do some 3D geometry things from [this paper](http://blog.m.gilbertbernstein.com/resources/booleans2009.pdf) 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](https://www.wolframalpha.com/input?i2d=true&i=%7B%7B10732176%2C0%2C0%2C-17579304288%7D%2C%7B0%2C0%2C112710780%2C-184620257640%7D%2C%7B-107344692%2C-112710780%2C-112710780%2C175830605496%7D%2C%7B0%2C0%2C10732176%2C-17579304288%7D%7D).

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](https://github.com/apple/swift/issues/63571)).

1. Is it really wrong, or I'm missing something?
2. Does simd\_double4x4.determinant guarantee precision to the ULP?
3. 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.

---

<div class="post-metadata">

**Author:** ![tera](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/tera/32/38201_2.png) [@tera](https://forums.swift.org/u/tera)\
**Post date:** [February 26, 2023, 2:29pm UTC](https://forums.swift.org/t/determinants-seem-to-be-wrong-with-simd-double4x4-determinant/63366/2 "2023-02-26T14:29:15Z")

</div>

The mantissas of intermediate calculations overflow, hence the result. Try using smaller numbers (e.g. premultiply all matrix components by 1e-3, calculate determinant and then post multiply the result by 1e+3. Good question: could / should "determinant" do such an adjustment itself.

---

<div class="post-metadata">

**Author:** ![kunitsyn](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/kunitsyn/32/24587_2.png) [@kunitsyn](https://forums.swift.org/u/kunitsyn)\
**Post date:** [February 26, 2023, 3:05pm UTC](https://forums.swift.org/t/determinants-seem-to-be-wrong-with-simd-double4x4-determinant/63366/3 "2023-02-26T15:05:42Z")

</div>

Thank you for the answer, but unfortunately, I can't do that. I can change the expected range of the values that I have with no problem, but I cannot make them less precise, and by multiplying by 1e-3 that is not a power of 2 I will make my values less precise. I need to consider every bit of information that I have in mantissas, so that I could reliably say: this or that matrix's determinant is bigger, less or equal to 0.

---

<div class="post-metadata">

**Author:** ![JanWillemBrands](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/janwillembrands/32/14554_2.png) [@JanWillemBrands](https://forums.swift.org/u/JanWillemBrands)\
**Post date:** [February 26, 2023, 3:13pm UTC](https://forums.swift.org/t/determinants-seem-to-be-wrong-with-simd-double4x4-determinant/63366/4 "2023-02-26T15:13:22Z")

</div>

The paper you quoted suggested to store the plane coefficients as single precision and use double precision for intermediate result.

---

<div class="post-metadata">

**Author:** ![JanWillemBrands](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/janwillembrands/32/14554_2.png) [@JanWillemBrands](https://forums.swift.org/u/JanWillemBrands)\
**Post date:** [February 26, 2023, 5:00pm UTC](https://forums.swift.org/t/determinants-seem-to-be-wrong-with-simd-double4x4-determinant/63366/5 "2023-02-26T17:00:46Z")

</div>

@tera's suggestion to scale by 1000 doesn't work either, but scaling by 1000000 does:

```swift
import simd

let a = simd_double4(10.732176, 0, 0, -17579.304288)
let b = simd_double4(0, 0, 112.710780, -184620.257640)
let c = simd_double4(-107.344692, -112.710780, -112.710780, 175830.605496)
let d = simd_double4(0, 0, 10.732176, -17579.304288)

let m = simd_double4x4(a, b, c, d)

print(m.determinant) // prints 0.0

```

---

<div class="post-metadata">

**Author:** ![tera](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/tera/32/38201_2.png) [@tera](https://forums.swift.org/u/tera)\
**Post date:** [February 26, 2023, 5:09pm UTC](https://forums.swift.org/t/determinants-seem-to-be-wrong-with-simd-double4x4-determinant/63366/6 "2023-02-26T17:09:16Z")

</div>

> [@kunitsyn](#):
>
> I can change the expected range of the values that I have with no problem

Then just limit them to be less than, say, a million.

> [@JanWillemBrands](#):
>
> The paper you quoted suggested to store the plane coefficients as single precision and use double precision for intermediate result.

Indeed:

> [@](#):
>
> First, our predicates only take single-precision floating point input, but perform computation using double precision. This allows us to guarantee the absence of exponent overflow/underflow, and allows us to tighten our static error bounds.

Is there a _guarantee_ though? "float.max \* float.max \* 2" would still overflow. AFAIR determinant calculation of 4x4 matrix involves factors like `a*b*c*d`

> [@JanWillemBrands](#):
>
> @tera's suggestion to scale by 1000 doesn't work either

Interestingly it works just fine in this form:

```swift
let n = 1e-3
let a = simd_double4(10732176.0 * n, 0 * n, 0 * n, -17579304288.0 * n)
let b = simd_double4(0 * n, 0 * n, 112710780.0 * n, -184620257640.0 * n)
let c = simd_double4(-107344692.0 * n, -112710780.0 * n, -112710780.0 * n, 175830605496.0 * n)
let d = simd_double4(0 * n, 0 * n, 10732176.0 * n, -17579304288.0 * n)

```

Even with n = 0.2

---

<div class="post-metadata">

**Author:** ![scanon](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/scanon/32/2445_2.png) [@scanon](https://forums.swift.org/u/scanon)\
**Post date:** [February 26, 2023, 5:17pm UTC](https://forums.swift.org/t/determinants-seem-to-be-wrong-with-simd-double4x4-determinant/63366/7 "2023-02-26T17:17:11Z")

</div>

This question is out of scope for this forum, as it is a question about Apple's SDKs, rather than Swift. For follow-up, please either use feedback assistant or post on the developer forums [under the [simd] tag](https://developer.apple.com/forums/tags/simd).

However:

1. It's not "wrong"; simd's determinant operation uses the naive formulas, which are backwards-stable (i.e. suitable for most numerical use), but are not suitable for exact geometry primitives, as you have observed, because the sign of the determinant is numerically ill-conditioned.
2. No; that's prohibitively expensive and not appropriate for most uses of the determinant.
3. For boolean orientation tests, you don't actually need or want determinants; you need only to know the signum of the determinant. The simd headers provide [exact implementations](https://developer.apple.com/documentation/accelerate/2896688-simd_orient) of these derived from [Jonathan Shewchuk's work](https://www.cs.cmu.edu/~quake/robust.html), which you should use instead. There is more extensive documentation available in the simd/geometry.h header (see simd\_orient, simd\_incircle, and simd\_insphere, which are defined for 2- and 3-dimensional vectors of floats and doubles). E.g.:

> ```swift
> /*! @abstract Test the orientation of three 3d vectors.
> *
> * @param __x The first vector.
> * @param __y The second vector.
> * @param __z The third vector.
> *
> * @result Positive if (x, y, z) are positively oriented, zero if they
> * are coplanar, and negative if they are negatively oriented.
> *
> * @discussion For three-dimensional vectors, "positively oriented" is
> * equivalent to the ordering (x, y, z) following the "right hand rule",
> * or to the dot product of z with the cross product of x and y being
> * positive. */
> static float SIMD_CFUNC simd_orient(simd_float3 __x, simd_float3__ y, simd_float3 __z);
> 
> ```

Note that rescaling _does not change this_; the sign of the determinant is ill-conditioned, and these "errors" are not the result of overflow or underflow. Only using exact arithmetic or other numerical techniques (as used by the orientation primitives) can resolve the issue.

---

<div class="post-metadata">

**Author:** ![JanWillemBrands](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/janwillembrands/32/14554_2.png) [@JanWillemBrands](https://forums.swift.org/u/JanWillemBrands)\
**Post date:** [February 26, 2023, 6:40pm UTC](https://forums.swift.org/t/determinants-seem-to-be-wrong-with-simd-double4x4-determinant/63366/8 "2023-02-26T18:40:12Z")

</div>

It seems that the OP is aware of the simd\_orient function, but that has it's own prblems:

> <https://github.com/apple/swift/issues/63571>
>
> \<!--
> This repository tracks issues related to the implementation of the Swift
> …compiler, standard library, runtime, and tools that provide IDE support for
> Swift (e.g. code completion). If the bug relates to the implementation of a
> proprietary (closed-source) Apple framework such as UIKit, SwiftUI, Combine,
> etc., please report it to https://feedbackassistant.apple.com instead.
> \--\>
> 
> \*\*Description\*\*
> simd\_orient returns 0 where it shouldn't, on swift 5.7.1.
> 
> With three non-aligned points a, b & c on the XZ plane, represented as 3D double-precision SIMD vectors, and a point p = (0, -10, 0) which is clearly outside of the XZ plane, simd\_orient returns 0.
> 
> \*\*Steps to reproduce\*\*
> \`\`\`
> % swift repl
> Welcome to Apple Swift version 5.7.1 (swiftlang-5.7.1.135.3 clang-1400.0.29.51).
> Type :help for assistance.
> 1\> import simd
> 2\> let a = simd\_double3(1, 0, 0); let b = simd\_double3(0, 0, -1); let c = simd\_double3(-1, 0, 1)
> a: simd\_double3 = (1.000000e+00, 0.000000e+00, 0.000000e+00)
> b: simd\_double3 = (0.000000e+00, 0.000000e+00, -1.000000e+00)
> c: simd\_double3 = (-1.000000e+00, 0.000000e+00, 1.000000e+00)
> 3\> let p = simd\_double3(0, -10, 0)
> p: simd\_double3 = (0.000000e+00, -1.000000e+01, 0.000000e+00)
> 4\> simd\_dot(c - p, simd\_cross(a - p, b - p))
> $R0: Double = 30
> 5\> simd\_orient(a, b, c, p)
> $R1: Double = 0
> \`\`\`
> 
> This happens on macos Darwin 22.2.0, Intel i5-1038NG7 CPU. In the comment to simd\_orient declaration, it says that \_"Positively oriented" is equivalent to the vectors (a-d, b-d, c-d) following the "right hand rule", or to the dot product of c-d with the the cross product of a-d and b-d being positive.\_ Repeating this exact calculation, \`simd\_dot(c - p, simd\_cross(a - p, b - p))\`, correctly gives a positive answer, but simd\_orient does not.
> 
> \*\*Expected behavior\*\*
> simd\_orient returns something positive with these inputs.
> 
> \*\*Environment\*\*
> \- Swift compiler version info: \`swift-driver version: 1.62.15 Apple Swift version 5.7.1 (swiftlang-5.7.1.135.3 clang-1400.0.29.51)
> Target: x86\_64-apple-macosx13.0\`
> \- Deployment target: macos Darwin 22.2.0, Intel i5-1038NG7 CPU

---

<div class="post-metadata">

**Author:** ![JanWillemBrands](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/janwillembrands/32/14554_2.png) [@JanWillemBrands](https://forums.swift.org/u/JanWillemBrands)\
**Post date:** [February 26, 2023, 7:24pm UTC](https://forums.swift.org/t/determinants-seem-to-be-wrong-with-simd-double4x4-determinant/63366/9 "2023-02-26T19:24:58Z")

</div>

Copied into a Feedback assistant report (@kunitsyn I hope you don't mind?)

[https://feedbackassistant.apple.com/feedback/12015022](https://feedbackassistant.apple.com/feedback/12015022)

---

<div class="post-metadata">

**Author:** ![scanon](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/scanon/32/2445_2.png) [@scanon](https://forums.swift.org/u/scanon)\
**Post date:** [February 26, 2023, 7:26pm UTC](https://forums.swift.org/t/determinants-seem-to-be-wrong-with-simd-double4x4-determinant/63366/10 "2023-02-26T19:26:38Z")

</div>

Thanks for the report!

---

<div class="post-metadata">

**Author:** ![tera](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/tera/32/38201_2.png) [@tera](https://forums.swift.org/u/tera)\
**Post date:** [February 26, 2023, 10:22pm UTC](https://forums.swift.org/t/determinants-seem-to-be-wrong-with-simd-double4x4-determinant/63366/11 "2023-02-26T22:22:02Z")

</div>

> [@scanon](#):
>
> the sign of the determinant is ill-conditioned, and these "errors" are not the result of overflow or underflow. Only using exact arithmetic or other numerical techniques (as used by the orientation primitives) can resolve the issue.

Interestingly if to calculate determinant manually there's no issue whatsoever in this method:

```swift
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).

---

<div class="post-metadata">

**Author:** ![scanon](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/scanon/32/2445_2.png) [@scanon](https://forums.swift.org/u/scanon)\
**Post date:** [February 26, 2023, 10:53pm UTC](https://forums.swift.org/t/determinants-seem-to-be-wrong-with-simd-double4x4-determinant/63366/12 "2023-02-26T22:53:16Z")

</div>

No, that's not what's happening here. Because the computation is numerically unstable, the specific order of rounding errors introduced in the computation matters quite a bit; reordering it slightly will make it "correct" or not by dumb luck.

For that matter, determinants never involve divisions, and dividing values close to zero cannot cause a loss of accuracy--computing values very close to zero can, but the values would have to be quite a bit smaller than anything encountered in this computation could be.

---

<div class="post-metadata">

**Author:** ![scanon](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/scanon/32/2445_2.png) [@scanon](https://forums.swift.org/u/scanon)\
**Post date:** [February 26, 2023, 10:58pm UTC](https://forums.swift.org/t/determinants-seem-to-be-wrong-with-simd-double4x4-determinant/63366/13 "2023-02-26T22:58:55Z")

</div>

This turns out to be a very simple bug in the \<simd/geometry.h\> header, which can be worked around as follows:

```swift
import simd

func simd_orient_workaround12015022(
  _ a: simd_double3,
  _ b: simd_double3,
  _ c: simd_double3,
  _ d: simd_double3
) -> Double {
  let buf = simd_double4x3(a,b,c,d)
  return withUnsafePointer(to: buf) {
    $0.withMemoryRebound(to: Double.self, capacity: 16) {
      _simd_orient_pd3($0)
    }
  }
}

```

---

<div class="post-metadata">

**Author:** ![tera](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/tera/32/38201_2.png) [@tera](https://forums.swift.org/u/tera)\
**Post date:** [February 26, 2023, 11:29pm UTC](https://forums.swift.org/t/determinants-seem-to-be-wrong-with-simd-double4x4-determinant/63366/14 "2023-02-26T23:29:46Z")

</div>

> [@scanon](#):
>
> No, that's not what's happening here. Because the computation is numerically unstable, the specific order of rounding errors introduced in the computation matters quite a bit; reordering it slightly will make it "correct" or not by dumb luck.

Note that the above manual calculation is equivalent to:

```swift
a = 10732176.0
b = 112710780.0
c = -17579304288.0
d = 175830605496.0
e = -184620257640.0
f = -107344692.0

det = (((a*(0*(-b*c-d*a)+(b*(b*c-e*a)))-(0*((0*(-b*c-d*a))+b*(0*c-c*a))))+(f*((0*(b*c+e*a))-0*(0*c-c*a))))-(0*(0*(b*d-e*b)-0*(0*d+c*b))))

```

(Note that only + - and \* are used, no division.

Here's the tree in a hierarchical form with no simplifications:

```swift
(
	(
		(
			a*(b*(b*c - e*a) - 0*(b*c + d*a))
			-
			0*(b*(0*c - c*a) - 0*(b*c + d*a))
		)
		+
		f*(0*(b*c + e*a) - 0*(0*c - c*a))
	)
	-
	(
		0*(
			0*(b*d - e*b) - 0*(0*d + c*b)
		)
	)
)

```

simplifying:

```swift
(
	(
		(a*(b*(b*c - e*a) - 0) - 0)
		+
		f*(0 - 0)
	)
	-
	0*(0 - 0)
)

a*(b*(b*c - e*a))

```

The internal factor in parens is equivalent to:

`184620257640.0 * 10732176.0 - 112710780.0 * 17579304288.0 → 0`

and while it is "unstable" IRT whether that would give +0 or -0 or possibly some very small number, the overall result can never get to be something like "3.687e+17" of the original code.

---

<div class="post-metadata">

**Author:** ![scanon](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/scanon/32/2445_2.png) [@scanon](https://forums.swift.org/u/scanon)\
**Post date:** [February 27, 2023, 12:44am UTC](https://forums.swift.org/t/determinants-seem-to-be-wrong-with-simd-double4x4-determinant/63366/15 "2023-02-27T00:44:58Z")

</div>

> [@tera](#):
>
> and while it is "unstable" IRT whether that would give +0 or -0 or possibly some very small number, the overall result can never get to be something like "3.687e+17" of the original code.

The relevant part of the actual computation done by `.determinant` here ends up being:

```swift
x[0][0] (x[1][2] (x[2][3] x[3][1] - x[2][1] x[3][3]) +
         x[1][3] (x[2][1] x[3][2] - x[2][2] x[3][1]))

```

Substituting values and partially evaluating gives:

```swift
10732176 * (112710780 * (112710780 * -17579304288) - 184620257640 * (-112710780 * 10732176))

```

If evaluated exactly, this cancels to zero. But the scaled terms involved in the cancellation have magnitude of about 2.34E33, so we should expect rounding errors to be of the scale ulpOfOne \* 2.34E33, which is 5.32E17, which is exactly in line with the observed error; this is a "very small number" relative to the scale of the problem, as expected.

---

<div class="post-metadata">

**Author:** ![tera](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/tera/32/38201_2.png) [@tera](https://forums.swift.org/u/tera)\
**Post date:** [February 27, 2023, 1:19am UTC](https://forums.swift.org/t/determinants-seem-to-be-wrong-with-simd-double4x4-determinant/63366/16 "2023-02-27T01:19:14Z")

</div>

> [@scanon](#):
>
> For that matter, determinants never involve divisions

Not directly. One way to calculate determinate is to transform the matrix into the diagonal form – which involves division – and then multiply the diagonal elements.

> [@scanon](#):
>
> But the scaled terms involved in the cancellation have magnitude of about 2.34E33, so we should expect rounding errors to be of the scale ulpOfOne \* 2.34E33, which is 5.32E17, which is exactly in line with the observed error; this is a "very small number" relative to the scale of the problem, as expected.

You are right.

---

<div class="post-metadata">

**Author:** ![scanon](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/scanon/32/2445_2.png) [@scanon](https://forums.swift.org/u/scanon)\
**Post date:** [February 27, 2023, 1:32am UTC](https://forums.swift.org/t/determinants-seem-to-be-wrong-with-simd-double4x4-determinant/63366/17 "2023-02-27T01:32:10Z")

</div>

> [@tera](#):
>
> Not directly. One way to calculate determinate is to transform the matrix into the diagonal form – which involves division – and then multiply the diagonal elements.

Ok, true. (You would generally reduce to triangular form, not diagonal, as it's much, much cheaper, but no one does either one for 4x4 determinants.)

---

<div class="post-metadata">

**Author:** ![JanWillemBrands](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/janwillembrands/32/14554_2.png) [@JanWillemBrands](https://forums.swift.org/u/JanWillemBrands)\
**Post date:** [February 27, 2023, 7:59am UTC](https://forums.swift.org/t/determinants-seem-to-be-wrong-with-simd-double4x4-determinant/63366/18 "2023-02-27T07:59:47Z")

</div>

And the Float variant of simd\_orient does not have the same problem, right ?

---

<div class="post-metadata">

**Author:** ![scanon](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/scanon/32/2445_2.png) [@scanon](https://forums.swift.org/u/scanon)\
**Post date:** [February 27, 2023, 12:09pm UTC](https://forums.swift.org/t/determinants-seem-to-be-wrong-with-simd-double4x4-determinant/63366/19 "2023-02-27T12:09:58Z")

</div>

Correct.

---

<div class="post-metadata">

**Author:** ![scanon](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/scanon/32/2445_2.png) [@scanon](https://forums.swift.org/u/scanon)\
**Post date:** [September 29, 2023, 2:48pm UTC](https://forums.swift.org/t/determinants-seem-to-be-wrong-with-simd-double4x4-determinant/63366/20 "2023-09-29T14:48:09Z")

</div>

Following-up here: the bug that I gave a workaround for above is fixed in macOS 14 / iOS 17 and the rest of the newly released SDK updates. Note that the change needed was in the header rather than the library, so simply recompiling with the new SDK will result in code that works correctly on older OSes as well.
