title: increase precision in Rcpp floating-point output
body: <p>I'm trying to print more digits in double-precision output from an <code>Rcpp</code> function, but can't figure out how ... I've looked at <a href="https://stackoverflow.com/questions/554063/how-do-i-print-a-double-value-with-full-precision-using-cout">How do I print a double value with full precision using cout?</a> and elsewhere for the generic C++ answer, but I can't see how to do it in <code>Rcpp</code>, except by using <code>printf</code>, which I take to be a last resort ...</p>
  
  <pre><code>require(inline)
  code &lt;- '
      double x=1.0;
      std::cout.precision(10); // compiles but does nothing
      Rcpp::Rcout.precision(10); // compiles but does nothing
      printf("(1) %1.10lf\\n",x);  // works but bad practice
      Rcpp::Rcout &lt;&lt; "(2) " &lt;&lt; x &lt;&lt; std::endl;
      Rcpp::Rcout &lt;&lt; "(3) " &lt;&lt; std::setprecision(10) &lt;&lt; x &lt;&lt; std::endl;
      return Rcpp::wrap(0);
  '
  fun &lt;- rcpp(sig=c(v=0),body=code,includes="#include &lt;iomanip&gt;")
  fun(1)
  ## (1) 1.0000000000
  ## (2) 1
  ## (3) 1
  ## [1] 0
  </code></pre>