diff --git a/chapter2.lisp b/chapter2.lisp index f2bc972..b1cf998 100644 --- a/chapter2.lisp +++ b/chapter2.lisp @@ -97,3 +97,11 @@ and upper bound." (/ (- (upper-bound x) (lower-bound x)) 2.0)) +;; Exercise 2.10 +(defun div-interval (a b) + (if (zerop (width-interval b)) + (error "Cannot divide by 0 width interval") + (mul-interval + a + (make-interval (/ 1.0 (upper-bound b)) + (/ 1.0 (lower-bound b))))))