test used in computing square roots will not be very effective for finding the square roots of very small numbers. Also, in real computers, arithmetic operations are almost always performed with limited precision. This makes our test inadequate for very large numbers. Explain these statements, with examples showing how the test fails for small and large numbers. An alternative strategy for implementing
is to watch how
changes from one iteration to the next and to stop when the change is a very small fraction of the guess. Design a
procedure that uses this kind of end test. Does this work better for small and large numbers?
Here's one explanation: "For large radicands, the procedure sqrt-iter enters an infinite recursion because the tolerance is not scaled up to the large radicands and floating-point numbers are represented with limited precision so the absolute error at that scale is always greater than the tolerance."
7 months ago
The "solution" given is NOT a solution to the actual problem. In a correct solution, the good-enough? procedure should be modified to test against "a very small fraction of the guess," e.g., (.0000001 * guess). Instead of doing this, the "solution" just substitutes a smaller, still absolute, tolerance for .001, using 0.0000001. This improves the resolution for small numbers but doesn't work for large numbers and is not what is asked for.
5 months ago
3 months ago
Good day! For me it looks like
good-enough? procedure from the provided solution is still not good enough. I think we should check
|guess - next_guess| / guess is small. In the provided solution procedure checks that
|guess^2 - x| is less then small portion of
guess which is not what we asked.
You must log in to post a comment.Login
The problem with small numbers is easy enough to understand: the tolerance of .001 is arbitrary, and does not scale with the number whose square we are seeking, so with very small numbers, the resolution is insufficiently fine to improve the guess. The problem with large numbers is not intuitive, and the text does not prepare us to explain the problem.