|
Say that the number you want the root of is N, and that the current value of the computation is oldGuess. How can you tell when the results are close to perfect? A good answer might be:When oldGuess*oldGuess is very close to N. |
Ending Condition for the LoopWhen oldGuess*oldGuess is very close to N, then N/(oldGuess*oldGuess) == almost 1.00 or N/(oldGuess*oldGuess) - 1.00 == almost 0.00 Now we need to decide what "almost 0.00" means. If the variables are all of type double precision, then they will have about 15 decimal places of precision. To be safe, assume that 14 places of precision can be reached. "Almost zero" to 14 places of precision means "less than .00000000000001" |
QUESTION 13:What is .00000000000001 in scientific notation? Click Here after you have answered the question |