### BOOST_WARN_CLOSE( left, right, tolerance )
BOOST_CHECK_CLOSE( left, right, tolerance )
BOOST_REQUIRE_CLOSE( left, right, tolerance )

These tools are used to check left and right values on closeness using strong relationship defined by the predicate close_at_tolerance ( tolerance_src ). To check for the weak relationship use BOOST_<level>_PREDICATE tools. Note that to use these tools you need to include additional header floating_point_comparison.hpp.

The first parameter is the left compared value. The second parameter is the right compared value. Last third parameter defines the tolerance for the comparison in percentage units. For more details how to treat this value see close_at_tolerance description. Note that it required for left and right parameters to be of the same floating point type. You need to explicitly resolve any type mismatch to select which type to use for comparison.

#### Example: test.cpp

    #define BOOST_TEST_MAIN
    #include <boost/test/unit_test.hpp>
    #include <boost/test/floating_point_comparison.hpp>

    BOOST_AUTO_TEST_CASE( test )
    {
        double v1 = 1.23456e-10;
        double v2 = 1.23457e-10;

        BOOST_CHECK_CLOSE( v1, v2, 0.0001 );
        // Absolute value of difference between these two values is 1e-15. They seems
        // to be very close. But we want to checks that these values differ no more then 0.0001%
        // of their value. And this test will fail at tolerance supplied.
    }

#### Output:

Running 1 test case...
test.cpp(10): error in "test": difference between v1{1.23456e-10} and v2{1.234571e-10} exceeds 0.0001%
*** 1 failure detected in test suite "Master Test Suite"

#### Example: test.cpp

    #define BOOST_TEST_MAIN
    #include <boost/test/unit_test.hpp>
    #include <boost/test/floating_point_comparison.hpp>

    BOOST_AUTO_TEST_CASE( test )
    {
        double v1 = 1.23456e28;
        double v2 = 1.23457e28;

        BOOST_REQUIRE_CLOSE( v1, v2, 0.001 );
        // Absolute value of difference between these two values is 1e+23.
        // But we are interested only that it does not exeed 0.001% of a values compared
        // And this test will pass.
    }

#### Output:

#### See Also

BOOST_CHECK_EQUAL, BOOST_CHECK_CLOSE_FRACTION, BOOST_CHECK_SMALL, Floating point comparison algorithms