|
Boost Users : |
From: Vladimir Krasovsky (vkrasovsky_at_[hidden])
Date: 2005-02-17 08:14:25
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_comparison.html
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_at_[hidden]
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