churchyard / rpms / lmfit

Forked from rpms/lmfit a year ago
Clone
Blob Blame Raw
diff --git a/test/test_inversion.c b/test/test_inversion.c
index 5cb4673..cd65343 100644
--- a/test/test_inversion.c
+++ b/test/test_inversion.c
@@ -1,4 +1,5 @@
 #include "lminvert.h"
+#include <float.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <math.h>
@@ -62,8 +63,14 @@ int test(int n, double* A, int expect_singular)
     show_matrix("Ainv*A", UL, n);
     show_matrix("A*Ainv", UR, n);
     int err = 0;
-    const double eps0 = 4e-14;
-    const double eps1 = 4e-14;
+    double eps0, eps1;
+    if (DBL_EPSILON > 2e-19) {
+        eps0 = 1e-13;
+        eps1 = 1e-13;
+    } else {
+        eps0 = 4e-14;
+        eps1 = 4e-14;
+    }
     for (int i=0; i<n; ++i) {
         for (int j=0; j<n; ++j) {
             if (i==j ? fabs(UL[i*n+j]-1)>eps1 : fabs(UL[i*n+j])>eps0) {