Boost logo

Boost Users :

From: Gennadiy Rozental (gennadiy.rozental_at_[hidden])
Date: 2005-02-17 09:52:48


"Thomas Lemaire" <thomas.lemaire_at_[hidden]> wrote in message
news:42147384.30205_at_laas.fr...
> dear list,
>
> When executing a test defined by:
> BOOST_CHECK_CLOSE(t3.x(3), 0.0, epsilon);
>
> I get the message:
> difference between t3.x(3){2.34188e-17} and 0.0{0} exceeds 1e-08%
>
> where obviously the difference does not exceeds the given threshold
1e-08...
>
> What's going on ?
>
> --
> thomas

I really should put this into FAQ section.

This was discussed several times. The explanation lies in a fact that
Boost.Test uses different algorithm (from the one you implicitly assumed)
for FP values comparisons. Look into docs for more details. In this
algorithm no value (but zero itself) is close enough to zero. I plan to
implement BOOST_CHECK_SMALL macro that should be used instead for the checks
like above. Be aware though that it may not be what you really want.

Gennadiy


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net