Set the Approximate Equality option to control the level of accuracy used in boolean comparisons and truncation functions.
1. Define a function.
2. Write a program that implements Newton's Method and compares it to the result from the built-in function root.
The
root function is dependent on TOL, but does not respond to a TOL that is larger than 10-5.
Ensure that TOL has the System label.
3. Ensure that none of the calculation options under the Calculation tab, Worksheet Settings group, Calculation Options is selected, then call Newt and pass it the name of the function, a guess value and the maximum number of iterations.
Using the default value of TOL (TOL:=TOL1), Newt is allowed to perform 50 iterations and it runs all of them to reach the best approximate result under strict evaluation.
When the Approximate Equality option is disabled, numbers between –10-307 and +10-307 are considered to be 0, and comparisons are evaluated strictly, using the numbers themselves up to their double-floating point precision representation.
4. Go to step 2 and set TOL to TOL2. Newt reaches the exact results in 20 iterations.
5. Go to step 2 and set TOL back to TOL1.
6. On the Calculation tab, in the Worksheet Settings group, click Calculation Options then select Approximate Equality.
The value returned by Newton's Method changes from -0.152137970680457 to -0.152137970680580 and this is reached in 19 iterations.
When the Approximate Equality option is active, the absolute value of the difference between two numbers divided by their average must be less than 10-12 for them to be considered equal.
7. Verify that the returned values pass the equality test:
8. Go to step 2 and set TOL to TOL2. The value returned by root changes from -0.152137970680456 to -0.152137970680457 and this is reached in 19 iterations.
9. Verify that the returned values pass the equality test: