Add exercise 2.9

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

View File

@ -90,3 +90,10 @@
(make-interval (- (lower-bound b) (lower-bound a)) (make-interval (- (lower-bound b) (lower-bound a))
(- (upper-bound b) (upper-bound a)))) (- (upper-bound b) (upper-bound a))))
;; Exercise 2.9
(defun width-interval (x)
"Calculate width of an interval as half of the distance between lower
and upper bound."
(/ (- (upper-bound x) (lower-bound x))
2.0))