Add Exercise 2.10

This commit is contained in:
Tobias Eidelpes 2022-11-05 12:51:54 +01:00
parent 121cad7707
commit a14449600f

View File

@ -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))))))