Skip to content

Instantly share code, notes, and snippets.

@tetsu-miyagawa
Created July 2, 2015 05:21
Show Gist options
  • Save tetsu-miyagawa/ad28d5a6b02489fbd535 to your computer and use it in GitHub Desktop.
Save tetsu-miyagawa/ad28d5a6b02489fbd535 to your computer and use it in GitHub Desktop.
SICP Exercise 1.8
(define (cube-root x)
(cube-root-iter x x 1.0))
(define (cube-root-iter x prev-guess guess)
(if (good-enough?2 prev-guess guess) guess
(cube-root-iter x guess (improve3 x guess))))
(define (improve3 x guess)
(/ (+ (/ x (square guess)) guess guess) 3))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment