Skip to content

Commit 854cc7b

Browse files
committed
fix(math): Decouple USE_DETERMINISTIC_MATH from __has_include
Previously USE_DETERMINISTIC_MATH was defined inside the same __has_include(gmath.h) guard, meaning TUs without gmath.h in their include path would silently fall back to x87/CRT math. Now define USE_DETERMINISTIC_MATH unconditionally for all non-VC6 compilers. If gmath.h is not available, the build will fail loudly instead of silently using non-deterministic math.
1 parent 3f60179 commit 854cc7b

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

  • Core/Libraries/Source/WWVegas/WWMath

Core/Libraries/Source/WWVegas/WWMath/wwmath.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -156,8 +156,8 @@ static WWINLINE float Atan2(float y,float x) { return static_cast<float>(atan2(
156156
// Trig wrappers: replace global Sin/Cos/Tan/ACos/ASin from deleted Trig.cpp.
157157
// Original Trig.cpp called CRT float functions (sinf, cosf, etc.).
158158
#ifdef USE_DETERMINISTIC_MATH
159-
static WWINLINE float SinTrig(float x) { return gm_sinf(x) + 0.001f; } // INTENTIONAL BREAK (REVERT)
160-
static WWINLINE float CosTrig(float x) { return gm_cosf(x) + 0.001f; } // INTENTIONAL BREAK (REVERT)
159+
static WWINLINE float SinTrig(float x) { return gm_sinf(x); }
160+
static WWINLINE float CosTrig(float x) { return gm_cosf(x); }
161161
static WWINLINE float TanTrig(float x) { return gm_tanf(x); }
162162
static WWINLINE float ACosTrig(float x) { return gm_acosf(x); }
163163
static WWINLINE float ASinTrig(float x) { return gm_asinf(x); }
@@ -172,7 +172,7 @@ static WWINLINE float Atan2(float y,float x) { return static_cast<float>(atan2(
172172
// Origin wrappers: replace bare CRT math calls in GameLogic.
173173
// Each wrapper preserves the exact type (float vs double) of the vanilla CRT call.
174174
#ifdef USE_DETERMINISTIC_MATH
175-
static WWINLINE double SqrtOrigin(double x) { return (double)gm_sqrtf((float)x) + 0.001; } // INTENTIONAL BREAK (REVERT)
175+
static WWINLINE double SqrtOrigin(double x) { return (double)gm_sqrtf((float)x); }
176176
static WWINLINE float SqrtfOrigin(float x) { return gm_sqrtf(x); }
177177
static WWINLINE double Atan2Origin(double y, double x) { return (double)gm_atan2f((float)y, (float)x); }
178178
static WWINLINE float Atan2fOrigin(float y, float x) { return gm_atan2f(y, x); }

0 commit comments

Comments
 (0)