From cb1e96c069083507da1278d85ddd890ae15304c8 Mon Sep 17 00:00:00 2001 From: Kenneth Heafield Date: Wed, 4 Mar 2020 20:20:59 +0000 Subject: Get at least the PrepareA tests working --- test/test.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/test/test.h b/test/test.h index a1ca724..ac4a8f6 100644 --- a/test/test.h +++ b/test/test.h @@ -38,7 +38,9 @@ template void CompareEps(const Type* reference, const Type* actual, Index size, Type epsilon) { for (Index i = 0; i < size; ++i) { INFO("Inaccurate at " << i << ' ' << reference[i] << ' ' << actual[i]); - CHECK(fabs(reference[i] - actual[i]) < epsilon); + // Ratio to maximum value. + float threshold = epsilon * std::max(0.01f, fabs(reference[i])); + CHECK(fabs(reference[i] - actual[i]) < threshold); } } -- cgit v1.2.3