
Boost : 
From: Gennadiy Rozental (gennadiy.rozental_at_[hidden])
Date: 20070222 21:12:46
"John Maddock" <john_at_[hidden]> wrote in message
news:001e01c7542b$1acfa050$3d3e1452_at_fuji...
> Gennadiy Rozental wrote:
>> How about a compromise:
>>
>> BOOST_CHECK_PERCENT_DIFF
>> BOOST_CHECK_RELATIVE_DIFF
>> BOOST_CHECK_EPSILON_DIFF
>> BOOST_CHECK_ABSOLUTE_DIFF (do we need this one?)
>
> I could live with those. They still say what they do, but I'd like to
> hear
> other opinions.
>
>> So.Would you care to provide a error message body for the nonpercent
>> based tools?
>
> Well for instance:
>
> BOOST_CHECK_PERCENT_DIFF(x, y, tol);
>
> "Relative difference between x{%1%} and y{%2%} exceeds tol{%3%%}, the
> actual
> difference found was %4%%."
>
> BOOST_CHECK_RELATIVE_DIFF(x, y, tol);
>
> "Relative difference between x{%1%} and y{%2%} exceeds tol{%3%}}, the
> actual
> difference found was %4%."
>
> BOOST_CHECK_EPSILON_DIFF(x, y, tol)
>
> "Relative difference between x{%1%} and y{%2%} exceeds tol{%3%epsilon},
> the
> actual difference found was %4%epsilon."
>
> BOOST_CHECK_ABSOLUTE_DIFF(x, y, tol)
>
> "Absolute difference between x{%1%} and y{%2%} exceeds tol{%3%}}, the
> actual
> difference found was %4%."
>
> Probably you could figure out a way for them all to use the same code
> internally as there's not much variation between them?
I will have to review this later on at the point when I will be ready to
implement these.
> Note that compared to your existing messages I've added what the actual
> *found* difference was. This is something I've really missed in the
> existing messages: in some situations (say with 128bit long doubles) the
> difference can be very small  if you just cut and paste the values into a
> calculator to try and work out what the error rate actually was then
> truncation of input values leads to a zero result  how many calculators
> do
> you know that do 35digit precision? At times the only way I could
> actually
> work out what the difference was was either to:
>
> 1) Use a pencil and paper.
> 2) Do it my head (not advised).
> 3) step through the Boost.Test code to find out.
> 4) Write my own code to calculate it.
Yes. I remember you request. I also remember there were difficulties to
implement it. I will have to reconsider the issue again.
Gennadiy
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk