Boost logo

Boost :

From: Rozental, Gennadiy (gennadiy.rozental_at_[hidden])
Date: 2003-10-06 11:55:08


> Hello,
>
> I am new tho boost::test, and I tried to use it the following way :
>
> BOOST_CHECK_CLOSE(3.1415f, 3.1415, 1e-06);
>
> The compiler (VC++7.1) complains about using a float and a double in
> this comparison. And with a more complex expression, the
> message becomes unclear.
>
> I am not sure what would be best to solve this problem : Making
> template close_at_tolerance a two parameters template (is it
> worth the
> added complexity?), or just documenting this limit.
>
> Greeting,
>
> --
> Loïc

When you want to use floating point comparisons it's important to use the
same type everywhere. And the error message seems to be correct and
descriptive.
I may need to state it explicitly, but it seems obvious.

Gennadiy.


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