]> git.rkrishnan.org Git - sicp.git/blob - src/sicp/ex2_10.clj
Solutions to 4.27, 4.28 and 4.29.
[sicp.git] / src / sicp / ex2_10.clj
1 (ns sicp.ex2_10
2   (:use [sicp utils ch2_1_extended ex2_7]
3         [clojure.test]))
4
5 (defn new-div-interval [x y]
6   (let [l (lower-bound y)
7         u (upper-bound y)]
8     (if (or (and (pos? l)
9                  (neg? u))
10             (and (pos? u)
11                  (neg? l)))
12       (error "Division by a range spanning 0")
13       (div-interval x y))))