# [plt-scheme] HtDP 27.3.2 and 27.3.4

2009/7/4 David Yrueta <dyrueta at gmail.com>
>* Hi All --
*>*
*>* Questions for both exercises refer to the function "find-root" below:
*>*
*>* ;; find-root : (number -> number) number number -> number
*>* ;; to determine a number R such that f has a
*>* ;; root between R and (+ R TOLERANCE)
*>* ;;
*>* ;; ASSUMPTION: f is continuous and monotonic
*>* (define (find-root f left right)
*>* (cond
*>* [(<= (- right left) TOLERANCE) left]
*>* [else
*>* (local ((define mid (/ (+ left right) 2)))
*
You might consider using floating points.
Just change 2 to 2.0.
--
Jens Axel Søgaard
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20090704/24094b4b/attachment.html>