[test] investigating Borland test_fp_comparisons failure

The borland test failures all come down to failing CHECK_NOT_CLOSE macros defined within the test file. My understanding is poor, because it looks to me that the following cases SHOULD fail: CHECK_NOT_CLOSE( 0, 1e-20, 1e-5 ); CHECK_NOT_CLOSE( 0, 1e-30, 1e-5 ); CHECK_NOT_CLOSE( 0, -1e-10, 0.1 ); CHECK_NOT_CLOSE( 0.123456, 0.123457, 1e-4 ); CHECK_NOT_CLOSE( 1.111e-10, 1.112e-10, 0.08999 ); CHECK_NOT_CLOSE( 1, 1.0002, 1.1e-2 ); However, it is clear the following is a genuine error: CHECK_NOT_CLOSE( 0.123456, -0.123457, 1e-3 ); I am obviously missing something, as the majority of compilers pass the test as written. -- AlisdairM

The borland test failures all come down to failing CHECK_NOT_CLOSE macros defined within the test file.
My understanding is poor, because it looks to me that the following cases SHOULD fail:
CHECK_NOT_CLOSE( 0, 1e-20, 1e-5 ); CHECK_NOT_CLOSE( 0, 1e-30, 1e-5 ); CHECK_NOT_CLOSE( 0, -1e-10, 0.1 ); CHECK_NOT_CLOSE( 0.123456, 0.123457, 1e-4 );
CHECK_NOT_CLOSE( 1.111e-10, 1.112e-10, 0.08999 );
CHECK_NOT_CLOSE( 1, 1.0002, 1.1e-2 );
However, it is clear the following is a genuine error:
CHECK_NOT_CLOSE( 0.123456, -0.123457, 1e-3 );
I am obviously missing something, as the majority of compilers pass the test as written.
All of the above should pass, since the algotrithm used: x and y are close iff: |x-y| / |x| < tol/100 and |x-y| / |y| < tol/100 Obviosly nothing could be close to zero and rest are failing also. Gennadiy

Gennadiy Rozental wrote:
All of the above should pass, since the algotrithm used:
x and y are close iff:
|x-y| / |x| < tol/100 and |x-y| / |y| < tol/100
Obviosly nothing could be close to zero and rest are failing also.
In that case I find the algorithm to be confusingly named, as in all these cases the test value is 'closer' to zero than the delta. I would not expect closeness to zero (or any other arbitrary number) to affect a general proximity test. AlisdairM

"Alisdair Meredith" <alisdair.meredith@uk.renaultf1.com> wrote in message news:d98vdr$oia$1@sea.gmane.org...
Gennadiy Rozental wrote:
All of the above should pass, since the algotrithm used:
x and y are close iff:
|x-y| / |x| < tol/100 and |x-y| / |y| < tol/100
Obviosly nothing could be close to zero and rest are failing also.
In that case I find the algorithm to be confusingly named, as in all these cases the test value is 'closer' to zero than the delta. I would not expect closeness to zero (or any other arbitrary number) to affect a general proximity test.
There is a new tool introduced in this release called BOOST_CHECK_SMALL to check that some value is small enough (close to zero). That one uses absolute (vs. relative) values comparisons. Gennadiy
participants (3)
-
Alisdair Meredith
-
AlisdairM
-
Gennadiy Rozental