Imported Upstream version 1.57.0
[platform/upstream/boost.git] / libs / phoenix / test / stdlib / cmath.cpp
1 /*=============================================================================
2     Copyright (c) 2001-2007 Joel de Guzman
3
4     Distributed under the Boost Software License, Version 1.0. (See accompanying
5     file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
6 ==============================================================================*/
7
8 #include <cmath>
9 #include <boost/function.hpp>
10 #include <boost/phoenix/core.hpp>
11 #include <boost/phoenix/operator.hpp>
12 #include <boost/phoenix/stl/cmath.hpp>
13 #include <boost/detail/lightweight_test.hpp>
14
15 int main()
16 {
17     double eps = 0.000001;
18     using namespace boost::phoenix::arg_names;
19     boost::function<bool(double, double)> f = fabs(_1 - _2) < eps;
20
21     double x = boost::phoenix::pow(_1,_2)(2.,0.);
22
23     BOOST_TEST(f(0.0, 0 * eps));
24     BOOST_TEST(!f(0.0, eps));
25     BOOST_TEST(fabs(x-1.) < eps );
26 }