Boost C++ Libraries Home Libraries People FAQ More

PrevUpHomeNext

BOOST_level_CLOSE_FRACTION

BOOST_level_CLOSE_FRACTION(lhs, rhs, tolerance) compares the two floating-point arguments and considers them equal if they agree within the given tolerance. The tolerance is given as a percentage.

Example

BOOST_AUTO_TEST_CASE(example_close_fraction)
{
    BOOST_REQUIRE_CLOSE_FRACTION(100.f, 100.9f, 1.f);
    BOOST_REQUIRE_CLOSE_FRACTION(100.f, 99.1f, 1.f);
}


PrevUpHomeNext