Updated test programs with SDL_M_PI*

This commit is contained in:
Sam Lantinga 2022-11-25 10:57:12 -08:00
parent 05139f4a2e
commit 199423612c
3 changed files with 115 additions and 115 deletions

View file

@ -1963,10 +1963,10 @@ static int
cos_regularCases(void *args) cos_regularCases(void *args)
{ {
const d_to_d regular_cases[] = { const d_to_d regular_cases[] = {
{ -M_PI, -1.0 }, { -SDL_M_PIl, -1.0 },
{ -0.0, 1.0 }, { -0.0, 1.0 },
{ 0.0, 1.0 }, { 0.0, 1.0 },
{ M_PI, -1.0 } { SDL_M_PIl, -1.0 }
}; };
return helper_dtod("Cos", SDL_cos, regular_cases, SDL_arraysize(regular_cases)); return helper_dtod("Cos", SDL_cos, regular_cases, SDL_arraysize(regular_cases));
} }
@ -1979,24 +1979,24 @@ static int
cos_precisionTest(void *args) cos_precisionTest(void *args)
{ {
const d_to_d precision_cases[] = { const d_to_d precision_cases[] = {
{ M_PI * 1.0 / 10.0, 0.9510565162 }, { SDL_M_PIl * 1.0 / 10.0, 0.9510565162 },
{ M_PI * 2.0 / 10.0, 0.8090169943 }, { SDL_M_PIl * 2.0 / 10.0, 0.8090169943 },
{ M_PI * 3.0 / 10.0, 0.5877852522 }, { SDL_M_PIl * 3.0 / 10.0, 0.5877852522 },
{ M_PI * 4.0 / 10.0, 0.3090169943 }, { SDL_M_PIl * 4.0 / 10.0, 0.3090169943 },
{ M_PI * 5.0 / 10.0, 0.0 }, { SDL_M_PIl * 5.0 / 10.0, 0.0 },
{ M_PI * 6.0 / 10.0, -0.3090169943 }, { SDL_M_PIl * 6.0 / 10.0, -0.3090169943 },
{ M_PI * 7.0 / 10.0, -0.5877852522 }, { SDL_M_PIl * 7.0 / 10.0, -0.5877852522 },
{ M_PI * 8.0 / 10.0, -0.8090169943 }, { SDL_M_PIl * 8.0 / 10.0, -0.8090169943 },
{ M_PI * 9.0 / 10.0, -0.9510565162 }, { SDL_M_PIl * 9.0 / 10.0, -0.9510565162 },
{ M_PI * -1.0 / 10.0, 0.9510565162 }, { SDL_M_PIl * -1.0 / 10.0, 0.9510565162 },
{ M_PI * -2.0 / 10.0, 0.8090169943 }, { SDL_M_PIl * -2.0 / 10.0, 0.8090169943 },
{ M_PI * -3.0 / 10.0, 0.5877852522 }, { SDL_M_PIl * -3.0 / 10.0, 0.5877852522 },
{ M_PI * -4.0 / 10.0, 0.3090169943 }, { SDL_M_PIl * -4.0 / 10.0, 0.3090169943 },
{ M_PI * -5.0 / 10.0, 0.0 }, { SDL_M_PIl * -5.0 / 10.0, 0.0 },
{ M_PI * -6.0 / 10.0, -0.3090169943 }, { SDL_M_PIl * -6.0 / 10.0, -0.3090169943 },
{ M_PI * -7.0 / 10.0, -0.5877852522 }, { SDL_M_PIl * -7.0 / 10.0, -0.5877852522 },
{ M_PI * -8.0 / 10.0, -0.8090169943 }, { SDL_M_PIl * -8.0 / 10.0, -0.8090169943 },
{ M_PI * -9.0 / 10.0, -0.9510565162 } { SDL_M_PIl * -9.0 / 10.0, -0.9510565162 }
}; };
return helper_dtod_inexact("Cos", SDL_cos, precision_cases, SDL_arraysize(precision_cases)); return helper_dtod_inexact("Cos", SDL_cos, precision_cases, SDL_arraysize(precision_cases));
} }
@ -2080,10 +2080,10 @@ static int
sin_regularCases(void *args) sin_regularCases(void *args)
{ {
const d_to_d regular_cases[] = { const d_to_d regular_cases[] = {
{ -M_PI / 2, -1.0 }, { -SDL_M_PIl / 2, -1.0 },
{ -0.0, -0.0 }, { -0.0, -0.0 },
{ 0.0, 0.0 }, { 0.0, 0.0 },
{ M_PI / 2, 1.0 } { SDL_M_PIl / 2, 1.0 }
}; };
return helper_dtod("Sin", SDL_sin, regular_cases, SDL_arraysize(regular_cases)); return helper_dtod("Sin", SDL_sin, regular_cases, SDL_arraysize(regular_cases));
} }
@ -2097,24 +2097,24 @@ static int
sin_precisionTest(void *args) sin_precisionTest(void *args)
{ {
const d_to_d precision_cases[] = { const d_to_d precision_cases[] = {
{ M_PI * 1.0 / 10.0, 0.3090169943 }, { SDL_M_PIl * 1.0 / 10.0, 0.3090169943 },
{ M_PI * 2.0 / 10.0, 0.5877852522 }, { SDL_M_PIl * 2.0 / 10.0, 0.5877852522 },
{ M_PI * 3.0 / 10.0, 0.8090169943 }, { SDL_M_PIl * 3.0 / 10.0, 0.8090169943 },
{ M_PI * 4.0 / 10.0, 0.9510565162 }, { SDL_M_PIl * 4.0 / 10.0, 0.9510565162 },
{ M_PI * 6.0 / 10.0, 0.9510565162 }, { SDL_M_PIl * 6.0 / 10.0, 0.9510565162 },
{ M_PI * 7.0 / 10.0, 0.8090169943 }, { SDL_M_PIl * 7.0 / 10.0, 0.8090169943 },
{ M_PI * 8.0 / 10.0, 0.5877852522 }, { SDL_M_PIl * 8.0 / 10.0, 0.5877852522 },
{ M_PI * 9.0 / 10.0, 0.3090169943 }, { SDL_M_PIl * 9.0 / 10.0, 0.3090169943 },
{ M_PI, 0.0 }, { SDL_M_PIl, 0.0 },
{ M_PI * -1.0 / 10.0, -0.3090169943 }, { SDL_M_PIl * -1.0 / 10.0, -0.3090169943 },
{ M_PI * -2.0 / 10.0, -0.5877852522 }, { SDL_M_PIl * -2.0 / 10.0, -0.5877852522 },
{ M_PI * -3.0 / 10.0, -0.8090169943 }, { SDL_M_PIl * -3.0 / 10.0, -0.8090169943 },
{ M_PI * -4.0 / 10.0, -0.9510565162 }, { SDL_M_PIl * -4.0 / 10.0, -0.9510565162 },
{ M_PI * -6.0 / 10.0, -0.9510565162 }, { SDL_M_PIl * -6.0 / 10.0, -0.9510565162 },
{ M_PI * -7.0 / 10.0, -0.8090169943 }, { SDL_M_PIl * -7.0 / 10.0, -0.8090169943 },
{ M_PI * -8.0 / 10.0, -0.5877852522 }, { SDL_M_PIl * -8.0 / 10.0, -0.5877852522 },
{ M_PI * -9.0 / 10.0, -0.3090169943 }, { SDL_M_PIl * -9.0 / 10.0, -0.3090169943 },
{ -M_PI, 0.0 }, { -SDL_M_PIl, 0.0 },
}; };
return helper_dtod_inexact("Sin", SDL_sin, precision_cases, SDL_arraysize(precision_cases)); return helper_dtod_inexact("Sin", SDL_sin, precision_cases, SDL_arraysize(precision_cases));
} }
@ -2213,26 +2213,26 @@ static int
tan_precisionTest(void *args) tan_precisionTest(void *args)
{ {
const d_to_d precision_cases[] = { const d_to_d precision_cases[] = {
{ M_PI * 1.0 / 11.0, 0.2936264929 }, { SDL_M_PIl * 1.0 / 11.0, 0.2936264929 },
{ M_PI * 2.0 / 11.0, 0.6426609771 }, { SDL_M_PIl * 2.0 / 11.0, 0.6426609771 },
{ M_PI * 3.0 / 11.0, 1.1540615205 }, { SDL_M_PIl * 3.0 / 11.0, 1.1540615205 },
{ M_PI * 4.0 / 11.0, 2.1896945629 }, { SDL_M_PIl * 4.0 / 11.0, 2.1896945629 },
{ M_PI * 5.0 / 11.0, 6.9551527717 }, { SDL_M_PIl * 5.0 / 11.0, 6.9551527717 },
{ M_PI * 6.0 / 11.0, -6.9551527717 }, { SDL_M_PIl * 6.0 / 11.0, -6.9551527717 },
{ M_PI * 7.0 / 11.0, -2.1896945629 }, { SDL_M_PIl * 7.0 / 11.0, -2.1896945629 },
{ M_PI * 8.0 / 11.0, -1.1540615205 }, { SDL_M_PIl * 8.0 / 11.0, -1.1540615205 },
{ M_PI * 9.0 / 11.0, -0.6426609771 }, { SDL_M_PIl * 9.0 / 11.0, -0.6426609771 },
{ M_PI * 10.0 / 11.0, -0.2936264929 }, { SDL_M_PIl * 10.0 / 11.0, -0.2936264929 },
{ M_PI * -1.0 / 11.0, -0.2936264929 }, { SDL_M_PIl * -1.0 / 11.0, -0.2936264929 },
{ M_PI * -2.0 / 11.0, -0.6426609771 }, { SDL_M_PIl * -2.0 / 11.0, -0.6426609771 },
{ M_PI * -3.0 / 11.0, -1.1540615205 }, { SDL_M_PIl * -3.0 / 11.0, -1.1540615205 },
{ M_PI * -4.0 / 11.0, -2.1896945629 }, { SDL_M_PIl * -4.0 / 11.0, -2.1896945629 },
{ M_PI * -5.0 / 11.0, -6.9551527717 }, { SDL_M_PIl * -5.0 / 11.0, -6.9551527717 },
{ M_PI * -6.0 / 11.0, 6.9551527717 }, { SDL_M_PIl * -6.0 / 11.0, 6.9551527717 },
{ M_PI * -7.0 / 11.0, 2.1896945629 }, { SDL_M_PIl * -7.0 / 11.0, 2.1896945629 },
{ M_PI * -8.0 / 11.0, 1.1540615205 }, { SDL_M_PIl * -8.0 / 11.0, 1.1540615205 },
{ M_PI * -9.0 / 11.0, 0.6426609771 }, { SDL_M_PIl * -9.0 / 11.0, 0.6426609771 },
{ M_PI * -10.0 / 11.0, 0.2936264929 } { SDL_M_PIl * -10.0 / 11.0, 0.2936264929 }
}; };
return helper_dtod_inexact("Tan", SDL_tan, precision_cases, SDL_arraysize(precision_cases)); return helper_dtod_inexact("Tan", SDL_tan, precision_cases, SDL_arraysize(precision_cases));
} }
@ -2254,9 +2254,9 @@ acos_limitCases(void *args)
1.0, 0.0, result); 1.0, 0.0, result);
result = SDL_acos(-1.0); result = SDL_acos(-1.0);
SDLTest_AssertCheck(M_PI == result, SDLTest_AssertCheck(SDL_M_PIl == result,
"Acos(%f), expected %f, got %f", "Acos(%f), expected %f, got %f",
-1.0, M_PI, result); -1.0, SDL_M_PIl, result);
return TEST_COMPLETED; return TEST_COMPLETED;
} }
@ -2341,14 +2341,14 @@ asin_limitCases(void *args)
double result; double result;
result = SDL_asin(1.0); result = SDL_asin(1.0);
SDLTest_AssertCheck(M_PI / 2.0 == result, SDLTest_AssertCheck(SDL_M_PIl / 2.0 == result,
"Asin(%f), expected %f, got %f", "Asin(%f), expected %f, got %f",
1.0, M_PI / 2.0, result); 1.0, SDL_M_PIl / 2.0, result);
result = SDL_asin(-1.0); result = SDL_asin(-1.0);
SDLTest_AssertCheck(-M_PI / 2.0 == result, SDLTest_AssertCheck(-SDL_M_PIl / 2.0 == result,
"Asin(%f), expected %f, got %f", "Asin(%f), expected %f, got %f",
-1.0, -M_PI / 2.0, result); -1.0, -SDL_M_PIl / 2.0, result);
return TEST_COMPLETED; return TEST_COMPLETED;
} }
@ -2433,16 +2433,16 @@ atan_limitCases(void *args)
double result; double result;
result = SDL_atan(INFINITY); result = SDL_atan(INFINITY);
SDLTest_AssertCheck((M_PI / 2.0) - EPSILON <= result && SDLTest_AssertCheck((SDL_M_PIl / 2.0) - EPSILON <= result &&
result <= (M_PI / 2.0) + EPSILON, result <= (SDL_M_PIl / 2.0) + EPSILON,
"Atan(%f), expected %f, got %f", "Atan(%f), expected %f, got %f",
INFINITY, M_PI / 2.0, result); INFINITY, SDL_M_PIl / 2.0, result);
result = SDL_atan(-INFINITY); result = SDL_atan(-INFINITY);
SDLTest_AssertCheck((-M_PI / 2.0) - EPSILON <= result && SDLTest_AssertCheck((-SDL_M_PIl / 2.0) - EPSILON <= result &&
result <= (-M_PI / 2.0) + EPSILON, result <= (-SDL_M_PIl / 2.0) + EPSILON,
"Atan(%f), expected %f, got %f", "Atan(%f), expected %f, got %f",
-INFINITY, -M_PI / 2.0, result); -INFINITY, -SDL_M_PIl / 2.0, result);
return TEST_COMPLETED; return TEST_COMPLETED;
} }
@ -2530,8 +2530,8 @@ atan2_bothZeroCases(void *args)
const dd_to_d cases[] = { const dd_to_d cases[] = {
{ 0.0, 0.0, 0.0 }, { 0.0, 0.0, 0.0 },
{ -0.0, 0.0, -0.0 }, { -0.0, 0.0, -0.0 },
{ 0.0, -0.0, M_PI }, { 0.0, -0.0, SDL_M_PIl },
{ -0.0, -0.0, -M_PI }, { -0.0, -0.0, -SDL_M_PIl },
}; };
return helper_ddtod("SDL_atan2", SDL_atan2, cases, SDL_arraysize(cases)); return helper_ddtod("SDL_atan2", SDL_atan2, cases, SDL_arraysize(cases));
} }
@ -2548,9 +2548,9 @@ atan2_yZeroCases(void *args)
{ {
const dd_to_d cases[] = { const dd_to_d cases[] = {
{ 0.0, 1.0, 0.0 }, { 0.0, 1.0, 0.0 },
{ 0.0, -1.0, M_PI }, { 0.0, -1.0, SDL_M_PIl },
{ -0.0, 1.0, -0.0 }, { -0.0, 1.0, -0.0 },
{ -0.0, -1.0, -M_PI } { -0.0, -1.0, -SDL_M_PIl }
}; };
return helper_ddtod("SDL_atan2", SDL_atan2, cases, SDL_arraysize(cases)); return helper_ddtod("SDL_atan2", SDL_atan2, cases, SDL_arraysize(cases));
} }
@ -2563,10 +2563,10 @@ static int
atan2_xZeroCases(void *args) atan2_xZeroCases(void *args)
{ {
const dd_to_d cases[] = { const dd_to_d cases[] = {
{ 1.0, 0.0, M_PI / 2.0 }, { 1.0, 0.0, SDL_M_PIl / 2.0 },
{ -1.0, 0.0, -M_PI / 2.0 }, { -1.0, 0.0, -SDL_M_PIl / 2.0 },
{ 1.0, -0.0, M_PI / 2.0 }, { 1.0, -0.0, SDL_M_PIl / 2.0 },
{ -1.0, -0.0, -M_PI / 2.0 } { -1.0, -0.0, -SDL_M_PIl / 2.0 }
}; };
return helper_ddtod("SDL_atan2", SDL_atan2, cases, SDL_arraysize(cases)); return helper_ddtod("SDL_atan2", SDL_atan2, cases, SDL_arraysize(cases));
} }
@ -2587,24 +2587,24 @@ atan2_bothInfCases(void *args)
double result; double result;
result = SDL_atan2(INFINITY, INFINITY); result = SDL_atan2(INFINITY, INFINITY);
SDLTest_AssertCheck(M_PI / 4.0 == result, SDLTest_AssertCheck(SDL_M_PIl / 4.0 == result,
"Atan2(%f,%f), expected %f, got %f", "Atan2(%f,%f), expected %f, got %f",
INFINITY, INFINITY, M_PI / 4.0, result); INFINITY, INFINITY, SDL_M_PIl / 4.0, result);
result = SDL_atan2(INFINITY, -INFINITY); result = SDL_atan2(INFINITY, -INFINITY);
SDLTest_AssertCheck(3.0 * M_PI / 4.0 == result, SDLTest_AssertCheck(3.0 * SDL_M_PIl / 4.0 == result,
"Atan2(%f,%f), expected %f, got %f", "Atan2(%f,%f), expected %f, got %f",
INFINITY, -INFINITY, 3.0 * M_PI / 4.0, result); INFINITY, -INFINITY, 3.0 * SDL_M_PIl / 4.0, result);
result = SDL_atan2(-INFINITY, INFINITY); result = SDL_atan2(-INFINITY, INFINITY);
SDLTest_AssertCheck(-M_PI / 4.0 == result, SDLTest_AssertCheck(-SDL_M_PIl / 4.0 == result,
"Atan2(%f,%f), expected %f, got %f", "Atan2(%f,%f), expected %f, got %f",
-INFINITY, INFINITY, -M_PI / 4.0, result); -INFINITY, INFINITY, -SDL_M_PIl / 4.0, result);
result = SDL_atan2(-INFINITY, -INFINITY); result = SDL_atan2(-INFINITY, -INFINITY);
SDLTest_AssertCheck(-3.0 * M_PI / 4.0 == result, SDLTest_AssertCheck(-3.0 * SDL_M_PIl / 4.0 == result,
"Atan2(%f,%f), expected %f, got %f", "Atan2(%f,%f), expected %f, got %f",
-INFINITY, -INFINITY, -3.0 * M_PI / 4.0, result); -INFINITY, -INFINITY, -3.0 * SDL_M_PIl / 4.0, result);
return TEST_COMPLETED; return TEST_COMPLETED;
} }
@ -2619,24 +2619,24 @@ atan2_yInfCases(void *args)
double result; double result;
result = SDL_atan2(INFINITY, 1.0); result = SDL_atan2(INFINITY, 1.0);
SDLTest_AssertCheck(M_PI / 2.0 == result, SDLTest_AssertCheck(SDL_M_PIl / 2.0 == result,
"Atan2(%f,%f), expected %f, got %f", "Atan2(%f,%f), expected %f, got %f",
INFINITY, 1.0, M_PI / 2.0, result); INFINITY, 1.0, SDL_M_PIl / 2.0, result);
result = SDL_atan2(INFINITY, -1.0); result = SDL_atan2(INFINITY, -1.0);
SDLTest_AssertCheck(M_PI / 2.0 == result, SDLTest_AssertCheck(SDL_M_PIl / 2.0 == result,
"Atan2(%f,%f), expected %f, got %f", "Atan2(%f,%f), expected %f, got %f",
INFINITY, -1.0, M_PI / 2.0, result); INFINITY, -1.0, SDL_M_PIl / 2.0, result);
result = SDL_atan2(-INFINITY, 1.0); result = SDL_atan2(-INFINITY, 1.0);
SDLTest_AssertCheck(-M_PI / 2.0 == result, SDLTest_AssertCheck(-SDL_M_PIl / 2.0 == result,
"Atan2(%f,%f), expected %f, got %f", "Atan2(%f,%f), expected %f, got %f",
-INFINITY, 1.0, -M_PI / 2.0, result); -INFINITY, 1.0, -SDL_M_PIl / 2.0, result);
result = SDL_atan2(-INFINITY, -1.0); result = SDL_atan2(-INFINITY, -1.0);
SDLTest_AssertCheck(-M_PI / 2.0 == result, SDLTest_AssertCheck(-SDL_M_PIl / 2.0 == result,
"Atan2(%f,%f), expected %f, got %f", "Atan2(%f,%f), expected %f, got %f",
-INFINITY, -1.0, -M_PI / 2.0, result); -INFINITY, -1.0, -SDL_M_PIl / 2.0, result);
return TEST_COMPLETED; return TEST_COMPLETED;
} }
@ -2663,14 +2663,14 @@ atan2_xInfCases(void *args)
-1.0, INFINITY, -0.0, result); -1.0, INFINITY, -0.0, result);
result = SDL_atan2(1.0, -INFINITY); result = SDL_atan2(1.0, -INFINITY);
SDLTest_AssertCheck(M_PI == result, SDLTest_AssertCheck(SDL_M_PIl == result,
"Atan2(%f,%f), expected %f, got %f", "Atan2(%f,%f), expected %f, got %f",
1.0, -INFINITY, M_PI, result); 1.0, -INFINITY, SDL_M_PIl, result);
result = SDL_atan2(-1.0, -INFINITY); result = SDL_atan2(-1.0, -INFINITY);
SDLTest_AssertCheck(-M_PI == result, SDLTest_AssertCheck(-SDL_M_PIl == result,
"Atan2(%f,%f), expected %f, got %f", "Atan2(%f,%f), expected %f, got %f",
-1.0, -INFINITY, -M_PI, result); -1.0, -INFINITY, -SDL_M_PIl, result);
return TEST_COMPLETED; return TEST_COMPLETED;
} }
@ -2712,9 +2712,9 @@ static int
atan2_topRightQuadrantTest(void *args) atan2_topRightQuadrantTest(void *args)
{ {
const dd_to_d top_right_cases[] = { const dd_to_d top_right_cases[] = {
{ 1.0, 1.0, M_PI / 4.0 }, { 1.0, 1.0, SDL_M_PIl / 4.0 },
{ SQRT3, 3.0, M_PI / 6.0 }, { SQRT3, 3.0, SDL_M_PIl / 6.0 },
{ SQRT3, 1.0, M_PI / 3.0 } { SQRT3, 1.0, SDL_M_PIl / 3.0 }
}; };
return helper_ddtod_inexact("SDL_atan2", SDL_atan2, top_right_cases, SDL_arraysize(top_right_cases)); return helper_ddtod_inexact("SDL_atan2", SDL_atan2, top_right_cases, SDL_arraysize(top_right_cases));
} }
@ -2727,9 +2727,9 @@ static int
atan2_topLeftQuadrantTest(void *args) atan2_topLeftQuadrantTest(void *args)
{ {
const dd_to_d top_left_cases[] = { const dd_to_d top_left_cases[] = {
{ 1.0, -1.0, 3.0 * M_PI / 4.0 }, { 1.0, -1.0, 3.0 * SDL_M_PIl / 4.0 },
{ SQRT3, -3.0, 5.0 * M_PI / 6.0 }, { SQRT3, -3.0, 5.0 * SDL_M_PIl / 6.0 },
{ SQRT3, -1.0, 2.0 * M_PI / 3.0 } { SQRT3, -1.0, 2.0 * SDL_M_PIl / 3.0 }
}; };
return helper_ddtod_inexact("SDL_atan2", SDL_atan2, top_left_cases, SDL_arraysize(top_left_cases)); return helper_ddtod_inexact("SDL_atan2", SDL_atan2, top_left_cases, SDL_arraysize(top_left_cases));
} }
@ -2742,9 +2742,9 @@ static int
atan2_bottomRightQuadrantTest(void *args) atan2_bottomRightQuadrantTest(void *args)
{ {
const dd_to_d bottom_right_cases[] = { const dd_to_d bottom_right_cases[] = {
{ -1.0, 1.0, -M_PI / 4 }, { -1.0, 1.0, -SDL_M_PIl / 4 },
{ -SQRT3, 3.0, -M_PI / 6.0 }, { -SQRT3, 3.0, -SDL_M_PIl / 6.0 },
{ -SQRT3, 1.0, -M_PI / 3.0 } { -SQRT3, 1.0, -SDL_M_PIl / 3.0 }
}; };
return helper_ddtod_inexact("SDL_atan2", SDL_atan2, bottom_right_cases, SDL_arraysize(bottom_right_cases)); return helper_ddtod_inexact("SDL_atan2", SDL_atan2, bottom_right_cases, SDL_arraysize(bottom_right_cases));
} }
@ -2757,9 +2757,9 @@ static int
atan2_bottomLeftQuadrantTest(void *args) atan2_bottomLeftQuadrantTest(void *args)
{ {
const dd_to_d bottom_left_cases[] = { const dd_to_d bottom_left_cases[] = {
{ -1.0, -1.0, -3.0 * M_PI / 4.0 }, { -1.0, -1.0, -3.0 * SDL_M_PIl / 4.0 },
{ -SQRT3, -3.0, -5.0 * M_PI / 6.0 }, { -SQRT3, -3.0, -5.0 * SDL_M_PIl / 6.0 },
{ -SQRT3, -1.0, -4.0 * M_PI / 6.0 } { -SQRT3, -1.0, -4.0 * SDL_M_PIl / 6.0 }
}; };
return helper_ddtod_inexact("SDL_atan2", SDL_atan2, bottom_left_cases, SDL_arraysize(bottom_left_cases)); return helper_ddtod_inexact("SDL_atan2", SDL_atan2, bottom_left_cases, SDL_arraysize(bottom_left_cases));
} }

View file

@ -127,7 +127,7 @@ rotate_matrix(float angle, float x, float y, float z, float *r)
float radians, c, s, c1, u[3], length; float radians, c, s, c1, u[3], length;
int i, j; int i, j;
radians = (float)(angle * M_PI) / 180.0f; radians = (angle * SDL_M_PIf) / 180.0f;
c = SDL_cosf(radians); c = SDL_cosf(radians);
s = SDL_sinf(radians); s = SDL_sinf(radians);

View file

@ -1032,8 +1032,8 @@ static SDL_bool render(void)
} }
currentTime = (double)SDL_GetPerformanceCounter() / SDL_GetPerformanceFrequency(); currentTime = (double)SDL_GetPerformanceCounter() / SDL_GetPerformanceFrequency();
clearColor.float32[0] = (float)(0.5 + 0.5 * SDL_sin(currentTime)); clearColor.float32[0] = (float)(0.5 + 0.5 * SDL_sin(currentTime));
clearColor.float32[1] = (float)(0.5 + 0.5 * SDL_sin(currentTime + M_PI * 2 / 3)); clearColor.float32[1] = (float)(0.5 + 0.5 * SDL_sin(currentTime + SDL_M_PIl * 2 / 3));
clearColor.float32[2] = (float)(0.5 + 0.5 * SDL_sin(currentTime + M_PI * 4 / 3)); clearColor.float32[2] = (float)(0.5 + 0.5 * SDL_sin(currentTime + SDL_M_PIl * 4 / 3));
clearColor.float32[3] = 1; clearColor.float32[3] = 1;
rerecordCommandBuffer(frameIndex, &clearColor); rerecordCommandBuffer(frameIndex, &clearColor);
submitInfo.sType = VK_STRUCTURE_TYPE_SUBMIT_INFO; submitInfo.sType = VK_STRUCTURE_TYPE_SUBMIT_INFO;