1 // Copyright 2012 John Maddock. Distributed under the Boost
2 // Software License, Version 1.0. (See accompanying file
3 // LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt
7 #include <boost/multiprecision/mpc.hpp>
8 #include <boost/math/constants/constants.hpp>
10 using boost::multiprecision::mpc_complex_100;
12 template <class Complex>
15 typedef typename Complex::value_type Real;
16 Complex ya = {5.2, 7.4};
17 Complex yb = {8.2, 7.3};
19 auto I0 = (ya + yb) * h;
20 Complex I1 = I0 / 2 + yb * h;
22 //I1 = I0; // not supposed to work.
25 typename Complex::value_type theta = 0.2;
28 Complex arg = z * sin(theta) - n * theta;
34 Complex den = z + v * cscv * exp(-v * cotv);
36 boost::multiprecision::number<boost::multiprecision::backends::mpc_complex_backend<100> > a = 2;
37 boost::multiprecision::number<boost::multiprecision::backends::mpc_complex_backend<100> > b = 3;
44 template <class F, class Real>
45 typename std::result_of_t<F(Real)> some_functional(F f, Real a, Real b)
47 if (a <= -boost::math::tools::max_value<Real>())
55 template <class Complex>
56 void test_functional()
58 typedef typename Complex::value_type Real;
59 auto f = [](Real x) -> Complex { Complex z(x, 3); return z; };
62 Complex result = some_functional(f, a, b);
67 test_overloads<mpc_complex_100>();
68 test_functional<mpc_complex_100>();