exec 1.8

(define (square x)
  (* x x)
)


(define (good-enough guess x)
  (< (abs(- (square guess) x)) 0.001)
  )


(define (improve guess x)
  (/ (+ (/ x (square guess)) (* guess 2.0)) 3.0)
)


(define (cube-root-iter guess x)
  (if (good-enough guess x)
    guess
    (cube-root-iter (improve guess x) x)
  )
)


(define (cube-root x)
  (cube-root-iter 1.0 x))

你可能感兴趣的:(exec 1.8)