Difference between BOOST_CHECK_CLOSE and BOOST_CHECK_CLOSE_FRACTION?

Posted by Rhys Ulerich on Stack Overflow See other posts from Stack Overflow or by Rhys Ulerich
Published on 2009-07-07T16:44:44Z Indexed on 2010/05/31 5:02 UTC
Read the original article Hit count: 270

Filed under:

Can anyone describe the difference in behavior between BOOST_CHECK_CLOSE and BOOST_CHECK_CLOSE_FRACTION? The documentation implies the that both macros treat their third parameter identically, which makes me suspect the documentation is wrong.

In particular, BOOST_CHECK_CLOSE_FRACTION gives me some odd looking results:

error in "...": difference between *expected{0} and *actual{-1.7763568394002506e-16} exceeds 9.9999999999999995e-07

Is there a gotcha because I expect a zero result? I've not been successful at reading through the underlying macro declarations. Please note BOOST_CHECK_SMALL isn't appropriate for my use case (comparing two vectors after a linear algebra operation).

© Stack Overflow or respective owner

Related posts about boost