From: Ramakrishnan Muthukrishnan Date: Mon, 7 Jun 2010 12:08:11 +0000 (+0530) Subject: added approx-equal function X-Git-Url: https://git.rkrishnan.org/webform_css?a=commitdiff_plain;h=94cf45cd947eaad3ac562c476f129224000ccf5e;p=sicp.git added approx-equal function --- 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.