Fixed roundEven implementation, tests are now passing
This commit is contained in:
@@ -167,70 +167,76 @@ int test_roundEven()
|
||||
int Error = 0;
|
||||
|
||||
{
|
||||
float A = glm::round(0.0f);
|
||||
float A = glm::roundEven(-1.5f);
|
||||
Error += A == -2.0f ? 0 : 1;
|
||||
Error += 0;
|
||||
}
|
||||
|
||||
{
|
||||
float A = glm::roundEven(0.0f);
|
||||
Error += A == 0.0f ? 0 : 1;
|
||||
float B = glm::round(0.5f);
|
||||
float B = glm::roundEven(0.5f);
|
||||
Error += B == 0.0f ? 0 : 1;
|
||||
float C = glm::round(1.0f);
|
||||
float C = glm::roundEven(1.0f);
|
||||
Error += C == 1.0f ? 0 : 1;
|
||||
float D = glm::round(0.1f);
|
||||
float D = glm::roundEven(0.1f);
|
||||
Error += D == 0.0f ? 0 : 1;
|
||||
float E = glm::round(0.9f);
|
||||
float E = glm::roundEven(0.9f);
|
||||
Error += E == 1.0f ? 0 : 1;
|
||||
float F = glm::round(1.5f);
|
||||
float F = glm::roundEven(1.5f);
|
||||
Error += F == 2.0f ? 0 : 1;
|
||||
float G = glm::round(1.9f);
|
||||
float G = glm::roundEven(1.9f);
|
||||
Error += G == 2.0f ? 0 : 1;
|
||||
}
|
||||
|
||||
{
|
||||
float A = glm::round(-0.0f);
|
||||
float A = glm::roundEven(-0.0f);
|
||||
Error += A == 0.0f ? 0 : 1;
|
||||
float B = glm::round(-0.5f);
|
||||
float B = glm::roundEven(-0.5f);
|
||||
Error += B == -0.0f ? 0 : 1;
|
||||
float C = glm::round(-1.0f);
|
||||
float C = glm::roundEven(-1.0f);
|
||||
Error += C == -1.0f ? 0 : 1;
|
||||
float D = glm::round(-0.1f);
|
||||
float D = glm::roundEven(-0.1f);
|
||||
Error += D == 0.0f ? 0 : 1;
|
||||
float E = glm::round(-0.9f);
|
||||
float E = glm::roundEven(-0.9f);
|
||||
Error += E == -1.0f ? 0 : 1;
|
||||
float F = glm::round(-1.5f);
|
||||
float F = glm::roundEven(-1.5f);
|
||||
Error += F == -2.0f ? 0 : 1;
|
||||
float G = glm::round(-1.9f);
|
||||
float G = glm::roundEven(-1.9f);
|
||||
Error += G == -2.0f ? 0 : 1;
|
||||
}
|
||||
|
||||
{
|
||||
float A = glm::round(1.5f);
|
||||
float A = glm::roundEven(1.5f);
|
||||
Error += A == 2.0f ? 0 : 1;
|
||||
float B = glm::round(2.5f);
|
||||
float B = glm::roundEven(2.5f);
|
||||
Error += B == 2.0f ? 0 : 1;
|
||||
float C = glm::round(3.5f);
|
||||
float C = glm::roundEven(3.5f);
|
||||
Error += C == 4.0f ? 0 : 1;
|
||||
float D = glm::round(4.5f);
|
||||
float D = glm::roundEven(4.5f);
|
||||
Error += D == 4.0f ? 0 : 1;
|
||||
float E = glm::round(5.5f);
|
||||
float E = glm::roundEven(5.5f);
|
||||
Error += E == 6.0f ? 0 : 1;
|
||||
float F = glm::round(6.5f);
|
||||
float F = glm::roundEven(6.5f);
|
||||
Error += F == 6.0f ? 0 : 1;
|
||||
float G = glm::round(7.5f);
|
||||
float G = glm::roundEven(7.5f);
|
||||
Error += G == 8.0f ? 0 : 1;
|
||||
}
|
||||
|
||||
{
|
||||
float A = glm::round(-1.5f);
|
||||
float A = glm::roundEven(-1.5f);
|
||||
Error += A == -2.0f ? 0 : 1;
|
||||
float B = glm::round(-2.5f);
|
||||
float B = glm::roundEven(-2.5f);
|
||||
Error += B == -2.0f ? 0 : 1;
|
||||
float C = glm::round(-3.5f);
|
||||
float C = glm::roundEven(-3.5f);
|
||||
Error += C == -4.0f ? 0 : 1;
|
||||
float D = glm::round(-4.5f);
|
||||
float D = glm::roundEven(-4.5f);
|
||||
Error += D == -4.0f ? 0 : 1;
|
||||
float E = glm::round(-5.5f);
|
||||
float E = glm::roundEven(-5.5f);
|
||||
Error += E == -6.0f ? 0 : 1;
|
||||
float F = glm::round(-6.5f);
|
||||
float F = glm::roundEven(-6.5f);
|
||||
Error += F == -6.0f ? 0 : 1;
|
||||
float G = glm::round(-7.5f);
|
||||
float G = glm::roundEven(-7.5f);
|
||||
Error += G == -8.0f ? 0 : 1;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user