(define (square x) (* x x))
(define (great-enough? guess newguess)
(< (abs (- 1 (/ guess newguess))) 0.0001))
(define (improve guess x)
(/ (+ (/ x (square guess)) (* 2 guess))
3))
(define (cube-root guess x)
(if (great-enough? guess (improve guess x))
guess
(cube-root (improve guess x) x)))
> (cube-root 1.0 8)
2.000004911675504
> (cube-root 1.0 1e9)
1000.0162369748963