Boost logo

Boost :

From: Gennadiy Rozental (gennadiy.rozental_at_[hidden])
Date: 2005-11-10 12:33:00

"John Maddock" <john_at_[hidden]> wrote in message
>I have a couple of feature requests for Boost.Test:
> 1) Can BOOST_CHECK_CLOSE please print the actual difference between the
> values (as a percent to match the tolerance) as well as the values
> themselves? The reason this is important, is that it's not always easy to
> get this value from the input values - because the precision of the
> machine
> on which the test is run far outstrips that of the author's machine, so
> his
> calculator isn't any use :-(

This is doable. The message would sould like this:

difference between var1 {<value>} and var2 {<value>} is x% and exceeds e%

> 2) Can we please have a BOOST_CHECK_EPSILON, that uses a whole number of
> epsilon as the tolerance? IMO BOOST_CHECK_CLOSE should have been written
> this way to begin with, but it's too late now

Actually it was this way originally. It was causing constant confusion with
absolute comparison. I thought persents will bring better message.
Unfortunately many users since then indicated that original version (for
those who knew how to use it) was better. If there is a general consensus I
am willing to rollback. Or we could introduce a new tool.

> Again it should print out
> the actual relative error as a multiple of epsilon as well as the input
> values. Actually while we're at it the absolute error may be useful to
> have
> in some situations as well :-)

This one already exists: BOOST_CHECK_SMALL( v, epsilon )

> BTW, in case it helps: I've switched to using std::pow(two,
> 1-std::numeric_limits<T>::digits) to calculate machine epsilon, because of
> the strange behaviour on Darwin with long doubles if you use
> numeric_limits<>::epsilon() (see

I will consider this.

> Thanks!
> John.



Boost list run by bdawes at, gregod at, cpdaniel at, john at