I'm using the Boost unit test-framework to compare doubles with each other. The results are as expected, but BOOST_CHECK_CLOSE does not recognize them correctly I guess. The code is essentially as follows:
BOOST_AUTO_TEST_CASE(FooBarTest)
{
double foo = 2.2500000047015632e-006;
double bar = 0.0;
double tolerance = 90.0;
BOOST_CHECK_CLOSE(foo, bar, tolerance);
}
This fails with the following message:
error in [...]: difference{1.#INF%} between foo{2.2500000047015632e-006} and bar{0} exceeds 90%
I'm using Boost 1.55 with VC100 (Visual Studio 10 compiler). I'm compiling Win32 Release.
Is this a result I should expect? I would imagine that these values are close enough to each other and it should return success. Is Boost internally dividing by 0.0?