Mathieu Champlon
On 05/09/2015 16:44, Mathieu Champlon wrote:
Hello,
Prior to boost 1.59 I had code using the floating point comparisons of Boost.Test as in
if( boost::test_tools::check_is_close( v1, v2, boost::test_tools::percent_tolerance( tolerance ) ) ) ...
if( boost::test_tools::check_is_close( v1, v2, boost::test_tools::fraction_tolerance( tolerance ) ) ) ...
As these seem to have been replaced/generalized starting with boost 1.59 I need to upgrade my code.
It looks like I can still use boost::test_tools::check_is_close like this respectively :
if( boost::test_tools::check_is_close( v1, v2, tolerance / 100 ) ) ...
if( boost::test_tools::check_is_close( v1, v2, tolerance ) ) ...
Am I right ?
check_is_close is deprecated. Inside of the test modules I recommend using new BOOST_TEST tool: BOOST_TEST( a==b, 3% tolerance() ) or BOOST_TEST( a==b, tolerance(0.0003) ) For other use cases you can use close_at_tolerance directly: fpc::close_at_tolerance<double> tester( 0.01, fpc::FPC_STRONG ); if( tester( a, b ) ) ... or fpc::close_at_tolerance<double> tester( fpc::percent_tolerance(0.01), fpc::FPC_STRONG ); if( tester( a, b ) ) ... Gennadiy