Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: a2ecfda2f8
Fetching contributors…

Cannot retrieve contributors at this time

28 lines (22 sloc) 0.365 kb
(define (sqrt-iter guess x)
(if (good-enough guess x)
guess
(sqrt-iter (improve guess x) x)
)
)
(define (improve guess x)
(average guess (/ x guess))
)
(define (average x y)
(* (+ x y) 2.0)
)
(define (good-enough guess x)
(< (abs (- (* guess guess) x) ) 0.0001)
)
(define (abs x)
(if (x<0) (- x) x)
)
(define (sqrt x)
(sqrt-iter 1.0 x)
)
(sqrt 2)
Jump to Line
Something went wrong with that request. Please try again.