Boost logo

Boost :

Subject: Re: [boost] boost-test, why is there no DOUBLES_EQUAL?
From: Gennadiy Rozental (rogeeff_at_[hidden])
Date: 2011-05-31 00:29:31


Sebastian Nowozin <nowozin <at> gmail.com> writes:

> The values I compare come from a Monte Carlo procedure, and are
> guaranteed to lie within a certain absolute tolerance.
> I compare the Monte Carlo results against exact values. Numerical
> stability is not an issue as these values are within the range zero to
> one.

This is quite a big range. You can get values around 0.1 or around 1e-15. Will
you be using the same tolerance in these cases?
 
> Therefore, you can safely assume that absolute deviation is the
> criteria I want to use, and is popularly used in the literature for
> this purpose (the so called total variation distance). I do not want
> to use relative comparisons, in particular because normalizing by a
> very small value such as 1.0e-10 can happen in that case.

So? This will only make the comparison fair.
1e-10 and 2e-10 will differ by 1e-10, but the second value is twice as big.
0.9000000001 and 0.9000000002 differs only insignificantly.

How can you catch this difference with absolute comparison? BOOST_CHECK_CLOSE on
the other hand will work correctly.

Gennadiy


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