From 414f06df86c39b7b6c13ebed1282e47b455bed63 Mon Sep 17 00:00:00 2001 From: Revar Desmera Date: Sat, 4 May 2019 20:19:35 -0700 Subject: [PATCH] Fixed scalar approx() --- math.scad | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/math.scad b/math.scad index bcbbc59..6d188ee 100644 --- a/math.scad +++ b/math.scad @@ -65,7 +65,7 @@ function constrain(v, minval, maxval) = min(maxval, max(minval, v)); // a = First value. // b = Second value. // eps = The maximum allowed difference between `a` and `b` that will return true. -function approx(a,b,eps=EPSILON) = let(c=a-b) (is_num(c)? c : norm(c)) <= eps; +function approx(a,b,eps=EPSILON) = let(c=a-b) (is_num(c)? abs(c) : norm(c)) <= eps; // Function: min_index()