Boost logo

Boost :

From: John Maddock (john_at_[hidden])
Date: 2007-02-19 05:05:27


Gennadiy Rozental wrote:
> Ok. How about
>
> BOOST_CHECK_PRC_DIFF
> BOOST_CHECK_REL_DIFF
> BOOST_CHECK_EPS_DIFF
>
> How about
>
> BOOST_CHECK_ABS_DIFF
>
> for absolute difference comparison?

Oh please no.... too cute and cryptic by half, they're not self-explanatory
at all.

> Wouldn't you were the one who advocated against epsilon() usage?

Was I? I'm not sure :-)

Certainly you need to be careful with it: numeric_limits<long
double>::epsilon() is meaningless on MAC OSX for example. But that's a good
reason to do it right in one place :-)

>>> I guess I could introduce these synonym if that will make everyone
>>> happy, but I personally still prefer shorter names.
>>
>> The main question then would be whether the synonyms would have
>> readable error messages: if they still refer to percentages folks
>> will get confused again :-)
>
> What kind of error message would you like for each tool to produce?
>
> Here is an example of BOOS_CHECK_CLOSE produce:
>
> difference between v1{1.23456e-10} and v2{1.234571e-10} exceeds
> 0.0001%

Which is fine if the tolerance is expressed as a percent, but not otherwise:
the error quoted needs to be expressed in the same units as are passed to
the macro, otherwise you'll just confuse folks again.

HTH, John.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk