Re: [Boost-users] unit test and BOOST_CHECK_CLOSE
Hello Thomas, Thursday, February 17, 2005, 1:35:48 PM, you wrote: Thomas> dear list, Thomas> When executing a test defined by: Thomas> BOOST_CHECK_CLOSE(t3.x(3), 0.0, epsilon); Thomas> I get the message: Thomas> difference between t3.x(3){2.34188e-17} and 0.0{0} exceeds 1e-08% Thomas> where obviously the difference does not exceeds the given threshold 1e-08... Thomas> What's going on ? As I remember, tolerance should be given in percents. See http://www.boost.org/libs/test/doc/components/test_tools/floating_point_comp... for more detailed description of algorithm used in BOOST_CHECK_CLOSE. Either I do not understand something or you cannot use BOOST_CHECK_CLOSE for direct comparison with 0.0. Inequations given never satisfied in case one of arguments is zero. I think you could write BOOST_CHECK(t3.x(3) >= -epsilon && t3.x(3) <= epsilon); given that epsilon is non-negative. -- Best regards, Vladimir mailto:vkrasovsky@yandex.ru
participants (1)
-
Vladimir Krasovsky