BOOST_WARN_SMALL( val, tolerance )
BOOST_CHECK_CLOSE( val, tolerance )
BOOST_REQUIRE_CLOSE( val, tolerance )

These tools are used to check that supplied values is small enough. The "smallness" is defined by absolute value of the tolerance supplied as a second argument. Note that to use these tools you need to include additional header floating_point_comparison.hpp. Use these tools with caution. To compare to values on closeness it's preferable to use BOOST_<level>_CLOSE tools.

The first parameter is the value to check. The second parameter is the tolerance .

Example: test.cpp

int test_main( int, char* [] ) {
    double v = -1.23456e-3;

    BOOST_CHECK_SMALL( v, 0.000001 );
    return 0;
}

Output:

test.cpp(4) : error in test_main: absolute value of v{1.23456e-3} exeeds 1e-06

See Also

BOOST_CHECK_CLOSE, Floating point comparison algorithms