mirror of
https://github.com/Redot-Engine/redot-engine.git
synced 2025-12-06 07:17:42 -05:00
Core: Replace C math headers with C++ equivalents
- Minor restructuring to ensure `math_funcs.h` is the central point for math functions
This commit is contained in:
@@ -248,8 +248,8 @@ TEST_CASE("[JSON] Serialization") {
|
||||
{ -1000.1234567890123456789, "-1000.12345678901" },
|
||||
{ DBL_MAX, "179769313486231570814527423731704356798070567525844996598917476803157260780028538760589558632766878171540458953514382464234321326889464182768467546703537516986049910576551282076245490090389328944075868508455133942304583236903222948165808559332123348274797826204144723168738177180919299881250404026184124858368.0" },
|
||||
{ DBL_MAX - 1, "179769313486231570814527423731704356798070567525844996598917476803157260780028538760589558632766878171540458953514382464234321326889464182768467546703537516986049910576551282076245490090389328944075868508455133942304583236903222948165808559332123348274797826204144723168738177180919299881250404026184124858368.0" },
|
||||
{ pow(2, 53), "9007199254740992.0" },
|
||||
{ -pow(2, 53), "-9007199254740992.0" },
|
||||
{ std::pow(2, 53), "9007199254740992.0" },
|
||||
{ -std::pow(2, 53), "-9007199254740992.0" },
|
||||
{ 0.00000000000000011, "0.00000000000000011" },
|
||||
{ -0.00000000000000011, "-0.00000000000000011" },
|
||||
{ 1.0 / 3.0, "0.333333333333333" },
|
||||
@@ -263,8 +263,8 @@ TEST_CASE("[JSON] Serialization") {
|
||||
{ -1000.1234567890123456789, "-1000.12345678901238" },
|
||||
{ DBL_MAX, "179769313486231570814527423731704356798070567525844996598917476803157260780028538760589558632766878171540458953514382464234321326889464182768467546703537516986049910576551282076245490090389328944075868508455133942304583236903222948165808559332123348274797826204144723168738177180919299881250404026184124858368.0" },
|
||||
{ DBL_MAX - 1, "179769313486231570814527423731704356798070567525844996598917476803157260780028538760589558632766878171540458953514382464234321326889464182768467546703537516986049910576551282076245490090389328944075868508455133942304583236903222948165808559332123348274797826204144723168738177180919299881250404026184124858368.0" },
|
||||
{ pow(2, 53), "9007199254740992.0" },
|
||||
{ -pow(2, 53), "-9007199254740992.0" },
|
||||
{ std::pow(2, 53), "9007199254740992.0" },
|
||||
{ -std::pow(2, 53), "-9007199254740992.0" },
|
||||
{ 0.00000000000000011, "0.00000000000000011" },
|
||||
{ -0.00000000000000011, "-0.00000000000000011" },
|
||||
{ 1.0 / 3.0, "0.333333333333333315" },
|
||||
|
||||
@@ -258,7 +258,7 @@ TEST_CASE_MAY_FAIL("[RandomNumberGenerator] randi_range bias check") {
|
||||
int val = rng->randi_range(0, 1);
|
||||
val == 0 ? zeros++ : ones++;
|
||||
}
|
||||
CHECK_MESSAGE(abs(zeros * 1.0 / ones - 1.0) < 0.1, "The ratio of zeros to ones should be nearly 1");
|
||||
CHECK_MESSAGE(std::abs(zeros * 1.0 / ones - 1.0) < 0.1, "The ratio of zeros to ones should be nearly 1");
|
||||
|
||||
int vals[10] = { 0 };
|
||||
for (int i = 0; i < 1000000; i++) {
|
||||
@@ -266,7 +266,7 @@ TEST_CASE_MAY_FAIL("[RandomNumberGenerator] randi_range bias check") {
|
||||
}
|
||||
|
||||
for (int i = 0; i < 10; i++) {
|
||||
CHECK_MESSAGE(abs(vals[i] / 1000000.0 - 0.1) < 0.01, "Each element should appear roughly 10% of the time");
|
||||
CHECK_MESSAGE(std::abs(vals[i] / 1000000.0 - 0.1) < 0.01, "Each element should appear roughly 10% of the time");
|
||||
}
|
||||
}
|
||||
} // namespace TestRandomNumberGenerator
|
||||
|
||||
Reference in New Issue
Block a user