From 94cf45cd947eaad3ac562c476f129224000ccf5e Mon Sep 17 00:00:00 2001 From: Ramakrishnan Muthukrishnan <vu3rdd@gmail.com> Date: Mon, 7 Jun 2010 17:38:11 +0530 Subject: [PATCH] added approx-equal function --- src/sicp/utils.clj | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/sicp/utils.clj b/src/sicp/utils.clj index f5c3e9c..258ac60 100644 --- a/src/sicp/utils.clj +++ b/src/sicp/utils.clj @@ -39,6 +39,9 @@ (/ (reduce + coll) (float (count coll)))) +(defn approx-equal [x y] + (< (abs (- x y)) 0.00001)) + (defmacro microbench " Evaluates the expression n number of times, returning the average time spent in computation, removing highest and lowest values. -- 2.45.2