Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>The <code>mpreal</code> is arbitrary precision floating-point numerical type. </p> <p>As such, <code>mpreal</code> numbers might have much more significant digits (even hundreds or thousandths) than <code>double</code>. Which means it is <strong>pointless to round</strong> <code>mpreal</code> <strong>to</strong> <code>double</code> before display - you will lose all the original accuracy in this case.</p> <p>It is easy to display <code>mpreal</code> in C++:</p> <pre><code>/* 100-digits accurate pi */ mpreal pi = mpfr::const_pi(mpfr::digits2bits(100)); /* Show 60-digits of pi */ cout.precision(60); cout &lt;&lt; pi; </code></pre> <p>However you can use it with <code>printf</code> as well (by converting to string first):</p> <pre><code>/* Display all digits (default formatting) */ printf("pi = %s\n", pi.toString().c_str()); /* Custom format, 60 digits */ printf("pi = %s\n", pi.toString("%.60RNf").c_str()); /* Using native printf from MPFR*/ mpfr_printf("pi = %.60RNf\n", pi.mpfr_srcptr()); </code></pre> <p>Format specification for multiple-precision numbers are the same as for standard with the exception to rounding specification. You can safely use rounding to nearest,<code>RN</code> as in examples above.</p> <p>More details on mp-formatting are given in <a href="http://www.mpfr.org/mpfr-current/#doc" rel="nofollow">MPFR documentation</a>.</p> <p>(I'm author of <code>mpreal</code> class aka <a href="http://www.holoborodko.com/pavel/mpfr/" rel="nofollow">MPFR C++</a>) </p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload