Skip to content

Fix uninitialized roll in toAngles - #91

Open
treeform wants to merge 1 commit into
masterfrom
floaty
Open

treeform wants to merge 1 commit into
masterfrom
floaty

Conversation

@treeform

@treeform treeform commented Sep 20, 2026 •

Copy link
Copy Markdown
Owner

Summary

`toAngles(Vec3)` never assigned `result.z` and `toAngles(Mat4)` skipped it in the gimbal lock branch. Release builds use `noinit`, so those fields were uninitialized memory and debug and release builds returned different bits for the same input. Both now set roll to zero explicitly.

Found by floaty's cross build digest test, which runs vmath through `patchFile("stdlib", "math", ...)` on 16 CI configurations and hashes the results. No define or other change to vmath is needed for that, so this PR is now only the bug fix.

Testing

`nim r tests/tests.nim` passes in debug and release, all three layouts, on Nim 2.2.6 and 2.2.12.

🤖 Generated with Claude Code

toAngles(Vec3) never assigned result.z and toAngles(Mat4) skipped it in
the gimbal lock branch. Release builds use noinit, so those fields were
uninitialized memory and debug and release builds returned different
bits for the same input. Found by floaty's cross build digest test.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@treeform treeform changed the title Add -d:vmathFloaty for deterministic math and fix uninitialized roll in toAngles Fix uninitialized roll in toAngles Sep 21, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant