lambda : fabs( x - y )< eps

I'm submitting this in case someone easily spots a less verbose
representation of fabs( x - y )< eps than the one shown below and would
like to share it. Using lambda (or variants) only (I know I can write my
own functor class). Thanks.
#include <cmath>
#include

AMDG On 03/10/2011 04:40 PM, er wrote:
I'm submitting this in case someone easily spots a less verbose representation of fabs( x - y )< eps than the one shown below and would like to share it. Using lambda (or variants) only (I know I can write my own functor class). Thanks.
How about using the attached cmath.hpp for phoenix?
#include <cmath>
#include

On 3/10/11 11:14 PM, Steven Watanabe wrote:
AMDG
On 03/10/2011 04:40 PM, er wrote:
I'm submitting this in case someone easily spots a less verbose representation of fabs( x - y )< eps than the one shown below and would like to share it. Using lambda (or variants) only (I know I can write my own functor class). Thanks.
How about using the attached cmath.hpp for phoenix?
Thanks, it looks worthwhile.
#include <cmath> #include
#include #include #include #include #include "cmath.hpp" int main() { double eps = 0.000001; using namespace boost::phoenix::arg_names; boost::function
f = fabs(_1 - _2) < eps; BOOST_ASSERT( f( 0.0, 0 * eps ) ); BOOST_ASSERT( !f( 0.0, eps ) ); }
In Christ, Steven Watanabe
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users

On Fri, Mar 11, 2011 at 5:14 AM, Steven Watanabe
AMDG
On 03/10/2011 04:40 PM, er wrote:
I'm submitting this in case someone easily spots a less verbose representation of fabs( x - y )< eps than the one shown below and would like to share it. Using lambda (or variants) only (I know I can write my own functor class). Thanks.
How about using the attached cmath.hpp for phoenix?
#include <cmath> #include
#include #include #include #include #include "cmath.hpp" int main() { double eps = 0.000001; using namespace boost::phoenix::arg_names; boost::function
f = fabs(_1 - _2) < eps; BOOST_ASSERT( f( 0.0, 0 * eps ) ); BOOST_ASSERT( !f( 0.0, eps ) ); }
In Christ, Steven Watanabe
Thanks! This is a nice and welcome contribution! I just committed it under the "stdlib" subdirectory. Thanks, Thomas
participants (3)
-
er
-
Steven Watanabe
-
Thomas Heller