初始化内容

This commit is contained in:
2026-09-16 14:07:40 +08:00
parent 6934b390bf
commit 4f643c1e7c
18350 changed files with 6088489 additions and 305 deletions
+29
View File
@@ -0,0 +1,29 @@
// Jolt Physics Library (https://github.com/jrouwe/JoltPhysics)
// SPDX-FileCopyrightText: 2023 Jorrit Rouwe
// SPDX-License-Identifier: MIT
#include "UnitTestFramework.h"
#include <atomic>
// Implemented as a global atomic so the compiler can't optimize it to a constant
extern atomic<float> One, OneTenth, Ten;
atomic<float> One = 1.0f, OneTenth = 0.1f /* Actually: 0.100000001f */, Ten = 10.0f;
JPH_PRECISE_MATH_ON
TEST_SUITE("PreciseMathTest")
{
TEST_CASE("CheckNoFMA")
{
// Should not use the FMA instruction and end up being zero
// If FMA is active, a * b will not be rounded to 1.0f so the result will be a small positive number
float a = OneTenth, b = Ten, c = One;
float result = a * b - c;
CHECK(result == 0.0f);
// Compiler should not optimize these variables away
One = OneTenth = Ten = 2.0f;
}
}
JPH_PRECISE_MATH_OFF