projects
/
sicp.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
20aa54a
)
added approx-equal function
author
Ramakrishnan Muthukrishnan
<vu3rdd@gmail.com>
Mon, 7 Jun 2010 12:08:11 +0000
(17:38 +0530)
committer
Ramakrishnan Muthukrishnan
<vu3rdd@gmail.com>
Mon, 7 Jun 2010 12:08:11 +0000
(17:38 +0530)
src/sicp/utils.clj
patch
|
blob
|
history
diff --git
a/src/sicp/utils.clj
b/src/sicp/utils.clj
index f5c3e9c6f04397a2466d1b7dc9760ad1d41e4ed1..258ac6080cb2b19e170c13cb04fcc4da42f48e24 100644
(file)
--- 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.