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

This commit is contained in:
Groove
2018-07-28 19:04:00 +02:00
parent 156ff1f4b2
commit 29f7e00e16
2 changed files with 5 additions and 4 deletions

View File

@@ -169,7 +169,7 @@ namespace refract
glm::dvec2 A(0.0f,-1.0f);
glm::dvec2 B(0.0f, 1.0f);
glm::dvec2 C = glm::refract(A, B, 0.5);
Error += C == glm::dvec2(0.0, -1.0) ? 0 : 1;
Error += glm::all(glm::equal(C, glm::dvec2(0.0, -1.0), 0.0001)) ? 0 : 1;
}
return Error;