Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Branch: master
Fetching contributors…

Cannot retrieve contributors at this time

19 lines (13 sloc) 0.448 kB
(define (square x) (* x x))
(define (improve guess target)
(/ (+ (/ target (square guess)) (* 2 guess))
3))
(define (good-enough? old-guess new-guess)
(< (abs (- old-guess new-guess)) (* old-guess 0.0001)))
(define (cube-root x)
(cube-iter 0 1.0 x))
(define (cube-iter old-guess new-guess target)
(if (good-enough? old-guess new-guess)
new-guess
(cube-iter new-guess (improve new-guess target) target)))
(cube-root 8)
Jump to Line
Something went wrong with that request. Please try again.