Boost logo

Boost :

From: John Maddock (john_at_[hidden])
Date: 2007-02-16 12:16:46


Gennadiy Rozental wrote:
> Which particular words/statements you are having difficulties with?

The problem for me is that it's too easy to forget that BOOST_CHECK_CLOSE
refers to a persentage and not a relative error. I've lost count of how
many times I've made that mistake, even though I do understand what it does.

BOOST_CHECK_CLOSE_FRACTION is an improvement, but still doesn't spell out
what it does.

Personally I would have liked these to have been really explicit:

BOOST_CHECK_PERSENTAGE_DIFFERENCE
BOOST_CHECK_RELATIVE_DIFFERENCE
BOOST_CHECK_EPSILON_DIFFERENCE

so that at double precision then I could use any of:

BOOST_CHECK_PERSENTAGE_DIFFERENCE(x, y, 4e-14); // ~ 2 eps as a percent

BOOST_CHECK_RELATIVE_DIFFERENCE(x, y, 4e-16); // ~ 2eps

BOOST_CHECK_EPSILON_DIFFERENCE(x, y, 2); // 2eps

depending upon my mood :-)

The last option is by far the most readable to me.

To put things another way: how many people do you expect to thinking in
terms of persentage differences between floating point numbers? I'm afraid
we (mostly) all think in terms of epsilon units, and once in that mind set,
converting to persentages just doesn't come naturally.

HTH,

John.


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