aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/utils.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/utils.h b/src/utils.h
index a11cd59e..3e0b3af9 100644
--- a/src/utils.h
+++ b/src/utils.h
@@ -142,8 +142,8 @@ static inline double angle_between(double x1, double y1, double z1,
static inline int within_tolerance(double a, double b, double percent)
{
- double tol = a * (percent/100.0);
- if ( fabs(b-a) < fabs(tol) ) return 1;
+ double tol = fabs(a) * (percent/100.0);
+ if ( fabs(b-a) < tol ) return 1;
return 0;
}