Boost logo

Boost :

From: rogeeff (rogeeff_at_[hidden])
Date: 2001-12-06 15:59:32


--- In boost_at_y..., Ullrich Koethe <u.koethe_at_c...> wrote:
> Dave Gomboc wrote:
> >
> > > What I suggest is to provide something like:
> > >
> > > template<class T> bool fp_equal(T const& l,T const& r) ;
> > > template<class T> bool fp_equal2(T const& l,T const& r, T
const& tol)
> > ;
> > > template<class T> bool fp_equal32(T const& l,T const& r, T
const& tol)
> > ;
> >
> > Using a fixed epsilon is bogus for the numerical applications
that I am
> > familiar with. What we really need to do is make the third
argument a
> > binary predicate returning bool whose operator() is called with
the
> > first two arguments. That wasn't a great explanation, but I hope
you
> > get what I mean.
> >
>
> So you mean there should be
>
> BOOST_CHECK_PREDICATE1( arg, unary_predicate)
> and
> BOOST_CHECK_PREDICATE2( left, right, binary_predicate)
>
> along with their relatives? Good idea. The float comparisions could
then
> be written
>
> BOOST_CHECK_PREDICATE2(left, right, close_at_tolerance(1.0e-5));
> BOOST_CHECK_PREDICATE2(left, right, weak_close_at_tolerance(1.0e-
5));
> BOOST_CHECK_PREDICATE2(left, right,
> close_at_estimated_tolerance(left, right,
number_of_operations));
> etc.
>
> Gennadyi, what do you think of this?

I think it's good idea. I can add this tools to the toolbax. They are
not related to floating-point comparison directly though and could be
valuable standalone. Regarding CHECK_CLOSE family: I would prefer to
keep them as short form of above statements.

Gennadiy.

> Ulli
> --
> ________________________________________________________________
> | |
> | Ullrich Koethe Universität Hamburg / University of Hamburg |
> | FB Informatik / Dept. of Computer Science |
> | AB Kognitive Systeme / Cognitive Systems Group |
> | |
> | Phone: +49 (0)40 42883-2573 Vogt-Koelln-Str. 30 |
> | Fax: +49 (0)40 42883-2572 D - 22527 Hamburg |
> | Email: u.koethe_at_c... Germany |
> | koethe_at_i... |
> | WWW: http://kogs-www.informatik.uni-hamburg.de/~koethe/ |
> |________________________________________________________________|


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