Introduced a second, less precise comparison epsilon for the tests for now.

This commit is contained in:
SGrottel 2021-05-11 07:44:40 +02:00
parent 18d9b97aa4
commit d71dba9603

View File

@ -17,6 +17,13 @@ GLM_INLINE GLM_CONSTEXPR float myEpsilon<float>() { return 0.00001f; }
template<> template<>
GLM_INLINE GLM_CONSTEXPR double myEpsilon<double>() { return 0.000001; } GLM_INLINE GLM_CONSTEXPR double myEpsilon<double>() { return 0.000001; }
template<typename T>
T myEpsilon2();
template<>
GLM_INLINE GLM_CONSTEXPR float myEpsilon2<float>() { return 0.01f; }
template<>
GLM_INLINE GLM_CONSTEXPR double myEpsilon2<double>() { return 0.000001; }
template<glm::length_t D, typename T, glm::qualifier Q> template<glm::length_t D, typename T, glm::qualifier Q>
bool vectorEpsilonEqual(glm::vec<D, T, Q> const& a, glm::vec<D, T, Q> const& b) bool vectorEpsilonEqual(glm::vec<D, T, Q> const& a, glm::vec<D, T, Q> const& b)
@ -329,7 +336,7 @@ namespace _1aga
for (int i = 0; i < D; ++i) for (int i = 0; i < D; ++i)
for (int d = 0; d < D; ++d) for (int d = 0; d < D; ++d)
if (!glm::equal(evecs[i][d], expectedEvecs[i * D + d], myEpsilon<T>())) if (!glm::equal(evecs[i][d], expectedEvecs[i * D + d], myEpsilon2<T>()))
{ {
fprintf(stderr, "E: %.15lf != %.15lf ; diff: %.20lf\n", fprintf(stderr, "E: %.15lf != %.15lf ; diff: %.20lf\n",
static_cast<double>(evecs[i][d]), static_cast<double>(evecs[i][d]),