Repository navigation
Conversation
`SymmetricEigen3::eigenvalues` called `acos` and `cos` as inherent float methods, which resolve to the platform math library in a `std` build even with the `libm` feature on; the `ComplexField` import that would route them through simba is compiled only without `std`. Inertia diagonalization in Rapier therefore differed between platforms with `enhanced-determinism` enabled (dimforge#9). Call the functions through `ComplexField` explicitly. Without the `libm` feature they still resolve to the standard library, so nothing changes for other users. Adds a test, gated on `libm` and `std`, that compares the result bit for bit with the closed form evaluated through `libm`. Fixes dimforge#9 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #9.
With the
libmfeature on (whichparry3d/rapier3denhanced-determinismenable),SymmetricEigen3::eigenvaluesstill called the platform math library in astdbuild:r.acos()andphi.cos()resolve to the inherentf64methods, and theComplexFieldimport that would route them through simba is compiled only withoutstd. Results therefore differed across platforms (observed: macOS x86-64 vs arm64/Linux x86-64) whenever a non-diagonal inertia tensor reached the trigonometric branch, which Rapier hits for any compound or rotated collider.This calls the three functions through
ComplexFieldexplicitly. Without thelibmfeature they still resolve to the standard library, so nothing changes for other users.Also adds a test, gated on
libm+std, that compares the eigenvalues bit for bit with the same closed form evaluated through thelibmcrate (newlibmdev-dependency), and a changelog entry.Verified:
cargo checkfor default,--all-features,--no-default-features --features libm,--features libm;cargo test --all-features(57 tests). In our project this change made a Rapier scene with a rotated compound collider bit-identical across macOS arm64, macOS x86-64 and Linux x86-64; the other shapes already agreed.🤖 Generated with Claude Code