From a14449600f613e3c557caff6e0c6c764fbbe24be Mon Sep 17 00:00:00 2001 From: Tobias Eidelpes Date: Sat, 5 Nov 2022 12:51:54 +0100 Subject: [PATCH] Add Exercise 2.10 --- chapter2.lisp | 8 ++++++++ 1 file changed, 8 insertions(+) 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))))))