Hi guys. Sorry if the question was answered long time ago, but I had not find it in older posts. It is about tolerance in relational tests in MC 2001. I guess this is known for all you but I'm relatively new to MC and it keeps surprising me.
One of my functions is giving wrong results in some rare cases. This function finds the minimum value of an array, locate that minimum, do some calcs and test the result against a reference value. After manually tracing the error I finally learned that:
- "min" function returns the true minimum value.
- "match" function returns position of match according to value of TOL.
- relational tests (<,=,>) work with a fixed tolerance of about 10^-13.
When 2 computed values differ in the least significant digits, maybe due to rounding, the described method can fail 'cause is not picking the true minimum value.
As work-around I found that I can lower the default tolerance to 10^-16 to make "match" return the true position of the true minimum, and doing relational tests against zero, i.e. test "a-b < 0" instead of "a < b".
My question: can I trust that the test against zero will work always? Testing against zero will do an absolute test?
Saludos,
Al