# 1.7

# SICP Exercise 1.7

Using absolute difference as a criteria for good-enough? will not work for calculating square roots of smaller numbers. Changing it to be a ratio instead would work for both larger and smaller numbers.

```
(define (sqrt-iter guess x)
(if (good-enough? guess)
guess
(sqrt-iter (improve guess x)
x)))
(define (improve guess x)
(average guess (/ x guess)))
(define (average x y)
(/ (+ x y) 2))
(define (good-enough? guess old-guess)
(< (/ old-guess guess) 0.001))
(define (square x) (* x x))
(define (sqrt x)
(sqrt-iter 1.0 x))
```