(define (sqrt x y z)
(define (half m n) (/ (+ m n) 2))
(define (square m) (* m m))
(cond ((and ( < (- (square (half x y)) z) 0.0001) ( > (- (square (half x y)) z) (- 0.0001))) (half x y))
((> (- (square (half x y)) z) 0.0001) (sqrt x (half x y) z))
((< (- (square (half x y)) z) (- 0.0001)) (sqrt (half x y) y z))))
x 区间开始
y 区间结束
z求的开平方数
调用
(sqrt 0 2 2)
1 ]=> (sqrt 0 2 2)
;Value: 11585/8192