aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2011-06-24 11:44:20 +0200
committerThomas White <taw@physics.org>2012-02-22 15:27:30 +0100
commit4aeeb2aeca15d2a6c8b529074e2b8bf2ac9ed3b5 (patch)
tree2393e18bcefc0065a9da743783eff510169afb59
parentd12bb3021e184e06101e22004e09f4d8323e2184 (diff)
Clarify fabs()
-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;
}