Also add a way to dynamically change the precision (needed for some test that don't use non full precision result matrix)
@@ -10,6 +10,7 @@
#ifndef DORAYME_MATH_HELPER_H
#define DORAYME_MATH_HELPER_H
+void set_equal_precision(double v);
bool double_equal(double a, double b);
#endif //DORAYME_MATH_HELPER_H
@@ -11,7 +11,14 @@
#include <float.h>
#include <math_helper.h>
+static double current_precision = FLT_EPSILON;
+
+void set_equal_precision(double v)
+{
+ current_precision = v;
+}
bool double_equal(double a, double b)
{
- return fabs(a - b) < DBL_EPSILON;
+ return fabs(a - b) < current_precision;
}