title: How to use complex numbers with boost::multiprecision::mpfr?
body: <p>According to <a href="https://stackoverflow.com/a/17932632/1700939">https://stackoverflow.com/a/17932632/1700939</a>, it should be possible to use complex numbers with boost::multiprecision with gcc-4.7. This indeed works fine with boost::multiprecision::float128:</p>
  
  <pre><code>-----------test.cpp------------
  #include &lt;cmath&gt;
  #include &lt;boost/multiprecision/float128.hpp&gt;
  
  using namespace std;
  
  typedef boost::multiprecision::float128 real_type_b;
  typedef complex&lt;real_type_b&gt; numeric_type_b;
  
  
  int main()
  {
  
      numeric_type_b a(2,2);
      numeric_type_b r = numeric_type_b(2,2)*a;
      a = sin(r);
      a = exp(r);
      cout &lt;&lt; a &lt;&lt; endl;
  
  }
  -----------test.cpp------------
  
  $ g++-4.7 -std=c++0x test.cpp -lquadmath -o test
  $ ./test
  (-0.1455,0.989358)
  </code></pre>
  
  <p>Trying the same thing with boost::multiprecision::mpfr fails for the <code>exp</code>-Function (<code>sin</code> works fine (!))</p>
  
  <pre><code>-----------test.cpp------------
  #include &lt;cmath&gt;
  #include &lt;boost/multiprecision/mpfr.hpp&gt;
  
  using namespace std;
  
  typedef boost::multiprecision::mpfr_float_500 real_type_b;
  typedef complex&lt;real_type_b&gt; numeric_type_b;
  
  
  int main()
  {
  
      numeric_type_b a(2,2);
      numeric_type_b r = numeric_type_b(2,2)*a;
      a = sin(r);
      a = exp(r);
      cout &lt;&lt; a &lt;&lt; endl;
  
  }
  -----------test.cpp------------
  </code></pre>
  
  <p>compilation fails:</p>
  
  <pre><code>$ g++-4.7 -std=c++0x test.cpp -lmpfr -o test
  In file included from /usr/include/boost/config/no_tr1/complex.hpp:21:0,
                  from /usr/include/boost/math/policies/error_handling.hpp:15,
                  from /usr/include/boost/multiprecision/detail/default_ops.hpp:9,
                  from /usr/include/boost/multiprecision/detail/generic_interconvert.hpp:9,
                  from /usr/include/boost/multiprecision/number.hpp:22,
                  from /usr/include/boost/multiprecision/mpfr.hpp:9,
                  from test.cpp:3:
  /usr/include/c++/4.7/complex: In instantiation of ‘std::complex&lt;_Tp&gt; std::__complex_exp(const std::complex&lt;_Tp&gt;&amp;) [with _Tp = boost::multiprecision::number&lt;boost::multiprecision::backends::mpfr_float_backend&lt;500u&gt; &gt;]’:
  /usr/include/c++/4.7/complex:751:68:   required from ‘std::complex&lt;_Tp&gt; std::exp(const std::complex&lt;_Tp&gt;&amp;) [with _Tp = boost::multiprecision::number&lt;boost::multiprecision::backends::mpfr_float_backend&lt;500u&gt; &gt;]’
  test.cpp:17:18:   required from here
  /usr/include/c++/4.7/complex:736:52: error: no matching function for call to ‘polar(boost::enable_if_c&lt;true, boost::multiprecision::detail::expression&lt;boost::multiprecision::detail::function, boost::multiprecision::detail::exp_funct&lt;boost::multiprecision::backends::mpfr_float_backend&lt;500u&gt; &gt;, boost::multiprecision::number&lt;boost::multiprecision::backends::mpfr_float_backend&lt;500u&gt; &gt;, void, void&gt; &gt;::type, boost::multiprecision::number&lt;boost::multiprecision::backends::mpfr_float_backend&lt;500u&gt; &gt;)’
  /usr/include/c++/4.7/complex:736:52: note: candidate is:
  /usr/include/c++/4.7/complex:662:5: note: template&lt;class _Tp&gt; std::complex&lt;_Tp&gt; std::polar(const _Tp&amp;, const _Tp&amp;)
  /usr/include/c++/4.7/complex:662:5: note:   template argument deduction/substitution failed:
  /usr/include/c++/4.7/complex:736:52: note:   deduced conflicting types for parameter ‘const _Tp’ (‘boost::multiprecision::detail::expression&lt;boost::multiprecision::detail::function, boost::multiprecision::detail::exp_funct&lt;boost::multiprecision::backends::mpfr_float_backend&lt;500u&gt; &gt;, boost::multiprecision::number&lt;boost::multiprecision::backends::mpfr_float_backend&lt;500u&gt; &gt;, void, void&gt;’ and ‘boost::multiprecision::number&lt;boost::multiprecision::backends::mpfr_float_backend&lt;500u&gt; &gt;’)
  </code></pre>
  
  <p>If however, the <code>exp</code>-line is commented out, it works:</p>
  
  <pre><code>$ g++-4.7 -std=c++0x test.cpp -lmpfr -o test
  $ ./test
  (0,1490.48)
  </code></pre>
  
  <p>Do i do something wrong, or did i encounter a bug here?</p>