Boost logo

Boost :

Subject: Re: [boost] [test] floating point comparison
From: Paul A. Bristow (pbristow_at_[hidden])
Date: 2015-04-26 09:58:00


> -----Original Message-----
> From: Boost [mailto:boost-bounces_at_[hidden]] On Behalf Of Gennadiy Rozental
> Sent: 26 April 2015 08:14
> To: boost_at_[hidden]
> Subject: Re: [boost] [test] floating point comparison
>
> Emil Dotchevski <emildotchevski <at> gmail.com> writes:
>
> >
> > Hello,
> >
> > Can someone please tell me exactly what do I need to include and which
> > namespace to use to get exact same behavior as:
> >
> > #include <boost/test/floating_point_comparison.hpp>
> >
> > bool check( float a, float b, float tolerance ) {
> > using namespace boost::test_tools;
> > return check_is_close(a,b,fraction_tolerance(tolerance));
> > }
> >
> > (The above used to work with older Boost versions but no longer.)
>
> Do you refer to the develop branch?
>
> BOOST_TEST(a==b, tolerance);
>
> should do the same. Or
>
> BOOST_TEST(a==b);
>
> if tolerance is set for test case.

As I have explained before, most recently about check_is_close, users would clearly like to use the
code in

#include <boost/test/floating_point_comparison.hpp>

outside Boost.Test.

I have put some time into providing documentation to go in Boost.Math that demonstrate and explain
how this can be done.

It would be *really unhelpful* to remove this facility.

Paul

---
Paul A. Bristow
Prizet Farmhouse
Kendal UK LA8 8AB
+44 (0) 1539 561830

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk