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
news:005301c5e616$7a3cef90$5c410352_at_fuji...
>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
> http://lists.boost.org/Archives/boost/2005/09/93390.php).

I will consider this.

> Thanks!
>
> John.

Regards,

Gennadiy


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