Fixed comparing floating point with == or != is unsafe error

This commit is contained in:
Groove 2018-07-27 00:02:35 +02:00
parent 4dce0e338d
commit 76707df1f1

View File

@ -112,7 +112,7 @@ namespace modf_
glm::vec4 I(0.0f);
glm::vec4 A = glm::modf(X, I);
Error += I == glm::vec4(1.0f) ? 0 : 1;
Error += glm::ivec4(I) == glm::ivec4(1.0f) ? 0 : 1;
Error += glm::all(glm::epsilonEqual(A, glm::vec4(0.1f, 0.2f, 0.5f, 0.7f), 0.00001f)) ? 0 : 1;
}
@ -121,7 +121,7 @@ namespace modf_
glm::dvec4 I(0.0);
glm::dvec4 A = glm::modf(X, I);
Error += I == glm::dvec4(1.0) ? 0 : 1;
Error += glm::ivec4(I) == glm::ivec4(1.0) ? 0 : 1;
Error += glm::all(glm::epsilonEqual(A, glm::dvec4(0.1, 0.2, 0.5, 0.7), 0.000000001)) ? 0 : 1;
}