Fix cross-platform math determinism (Mac/Linux)#217
Draft
fbraz3 wants to merge 6 commits into
Draft
Conversation
…determinism fixes - Replaced division by zero traps in float logic with Div_FixNaN - Included Div_FixNaN helper in wwmath.h - Added deterministic BezierMath (D3DXVec4Transform & D3DXVec4Dot) - Downcasted Atan2 double arguments to float - Backported PR #3 and #4 from Zero Hour to the base Generals game Ref: TheSuperHackers#3 Ref: TheSuperHackers#4
47f292e to
23f9aa6
Compare
…_availableOnFrame fix to Generals Missed during PR #3 backport: Remove RETAIL_COMPATIBLE_CRC guard around m_availableOnFrame initialization. Always set to 0 to prevent special powers from being stuck when RETAIL_COMPATIBLE_CRC is off.
- Force double-precision variants of SqrtOrigin and PowOrigin to downcast and use single-precision gm_*f implementations. - This prevents a known 1-ULP drift on ARM64 NEON vs x86 x87 FPU when evaluating double-precision transcendentals. - Documented NaN and double-precision determinism guidelines in AGENTS.md.
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.
Description
Fixes cross-platform math determinism between Mac (ARM64), Linux (x86_64) and Windows.
This addresses the math precision and ambiguity issues related to
SqrtOrigin,Atan2Origin, andPowOrigin.Changes
floatoverloads for deterministic math wrappers inwwmath.h.(float)casts to resolve ambiguous math function calls (e.g. inAIPathfind.cpp).Inf/NaNpropagating into integers.