
----Original Message---- From: Alisdair Meredith [mailto:alisdair.meredith@uk.renaultf1.com] Sent: 21 June 2005 12:59 To: boost@lists.boost.org Subject: Re: [boost] [test] investigating Borland test_fp_comparisons failure
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.
The tolerance is a percentage tolerance, rather than an absolute value. A percentage tolerance makes sense if you regard 1E-10 as far from 1 as 1 is from 1E10. If you do, then 0 is infinitely far from any other finite number. If you don't, then I suggest you are using floating point as an easy substitute for fixed-point arithmetic (which is what I do). -- Martin Bonner Martin.Bonner@Pitechnology.com Pi Technology, Milton Hall, Ely Road, Milton, Cambridge, CB4 6WZ, ENGLAND Tel: +44 (0)1223 441434