diff options
author | Lorry Tar Creator <lorry-tar-importer@baserock.org> | 2014-10-31 14:41:14 +0000 |
---|---|---|
committer | <> | 2014-12-12 16:07:56 +0000 |
commit | ed232fdd34968697a68783b3195b1da4226915b5 (patch) | |
tree | 7a7053ceb8874b28ec4b868d4c49b500008a102e /libs/multiprecision/doc | |
parent | 1c3648bf5b7d17fcd4fe9bc95802b16fd9eee304 (diff) | |
download | boost-tarball-ed232fdd34968697a68783b3195b1da4226915b5.tar.gz |
Imported from /home/lorry/working-area/delta_boost-tarball/boost_1_57_0.tar.bz2.boost_1_57_0
Diffstat (limited to 'libs/multiprecision/doc')
25 files changed, 554 insertions, 307 deletions
diff --git a/libs/multiprecision/doc/html/boost_multiprecision/indexes/s01.html b/libs/multiprecision/doc/html/boost_multiprecision/indexes/s01.html index ca98d0805..37b47bacc 100644 --- a/libs/multiprecision/doc/html/boost_multiprecision/indexes/s01.html +++ b/libs/multiprecision/doc/html/boost_multiprecision/indexes/s01.html @@ -24,7 +24,7 @@ </div> <div class="section"> <div class="titlepage"><div><div><h3 class="title"> -<a name="idm1549883056"></a>Function Index</h3></div></div></div> +<a name="idm1549766464"></a>Function Index</h3></div></div></div> <p><a class="link" href="s01.html#idx_id_0">A</a> <a class="link" href="s01.html#idx_id_1">B</a> <a class="link" href="s01.html#idx_id_2">C</a> <a class="link" href="s01.html#idx_id_3">D</a> <a class="link" href="s01.html#idx_id_4">E</a> <a class="link" href="s01.html#idx_id_5">F</a> <a class="link" href="s01.html#idx_id_7">I</a> <a class="link" href="s01.html#idx_id_8">L</a> <a class="link" href="s01.html#idx_id_9">M</a> <a class="link" href="s01.html#idx_id_11">O</a> <a class="link" href="s01.html#idx_id_12">P</a> <a class="link" href="s01.html#idx_id_13">R</a> <a class="link" href="s01.html#idx_id_14">S</a> <a class="link" href="s01.html#idx_id_15">T</a> <a class="link" href="s01.html#idx_id_17">V</a> <a class="link" href="s01.html#idx_id_18">Z</a></p> <div class="variablelist"><dl class="variablelist"> <dt> @@ -350,6 +350,10 @@ <div class="index"><ul class="index" style="list-style-type: none; "><li class="listitem" style="list-style-type: none"><p><a class="link" href="../ref/backendconc.html#boost_multiprecision.ref.backendconc.optional_requirements_on_the_bac" title="Table 1.9. Optional Requirements on the Backend Type"><span class="index-entry-level-1">Optional Requirements on the Backend Type</span></a></p></li></ul></div> </li> <li class="listitem" style="list-style-type: none"> +<p><span class="index-entry-level-0">eval_scalbn</span></p> +<div class="index"><ul class="index" style="list-style-type: none; "><li class="listitem" style="list-style-type: none"><p><a class="link" href="../ref/backendconc.html#boost_multiprecision.ref.backendconc.optional_requirements_on_the_bac" title="Table 1.9. Optional Requirements on the Backend Type"><span class="index-entry-level-1">Optional Requirements on the Backend Type</span></a></p></li></ul></div> +</li> +<li class="listitem" style="list-style-type: none"> <p><span class="index-entry-level-0">eval_sin</span></p> <div class="index"><ul class="index" style="list-style-type: none; "><li class="listitem" style="list-style-type: none"><p><a class="link" href="../ref/backendconc.html#boost_multiprecision.ref.backendconc.optional_requirements_on_the_bac" title="Table 1.9. Optional Requirements on the Backend Type"><span class="index-entry-level-1">Optional Requirements on the Backend Type</span></a></p></li></ul></div> </li> @@ -397,6 +401,10 @@ <div class="index"><ul class="index" style="list-style-type: none; "><li class="listitem" style="list-style-type: none"><p><a class="link" href="../tut/primetest.html" title="Primality Testing"><span class="index-entry-level-1">Primality Testing</span></a></p></li></ul></div> </li> <li class="listitem" style="list-style-type: none"> +<p><span class="index-entry-level-0">ilogb</span></p> +<div class="index"><ul class="index" style="list-style-type: none; "><li class="listitem" style="list-style-type: none"><p><a class="link" href="../ref/number.html" title="number"><span class="index-entry-level-1">number</span></a></p></li></ul></div> +</li> +<li class="listitem" style="list-style-type: none"> <p><span class="index-entry-level-0">in</span></p> <div class="index"><ul class="index" style="list-style-type: none; "><li class="listitem" style="list-style-type: none"><p><a class="link" href="../tut/interval/mpfi.html" title="mpfi_float"><span class="index-entry-level-1">mpfi_float</span></a></p></li></ul></div> </li> diff --git a/libs/multiprecision/doc/html/boost_multiprecision/indexes/s02.html b/libs/multiprecision/doc/html/boost_multiprecision/indexes/s02.html index 587043e9d..483326529 100644 --- a/libs/multiprecision/doc/html/boost_multiprecision/indexes/s02.html +++ b/libs/multiprecision/doc/html/boost_multiprecision/indexes/s02.html @@ -24,7 +24,7 @@ </div> <div class="section"> <div class="titlepage"><div><div><h3 class="title"> -<a name="idm1549390832"></a>Class Index</h3></div></div></div> +<a name="idm1549437632"></a>Class Index</h3></div></div></div> <p><a class="link" href="s02.html#idx_id_21">C</a> <a class="link" href="s02.html#idx_id_22">D</a> <a class="link" href="s02.html#idx_id_23">E</a> <a class="link" href="s02.html#idx_id_24">F</a> <a class="link" href="s02.html#idx_id_25">G</a> <a class="link" href="s02.html#idx_id_26">I</a> <a class="link" href="s02.html#idx_id_27">L</a> <a class="link" href="s02.html#idx_id_28">M</a> <a class="link" href="s02.html#idx_id_29">N</a> <a class="link" href="s02.html#idx_id_34">T</a></p> <div class="variablelist"><dl class="variablelist"> <dt> diff --git a/libs/multiprecision/doc/html/boost_multiprecision/indexes/s03.html b/libs/multiprecision/doc/html/boost_multiprecision/indexes/s03.html index bce78744e..071d5bfb4 100644 --- a/libs/multiprecision/doc/html/boost_multiprecision/indexes/s03.html +++ b/libs/multiprecision/doc/html/boost_multiprecision/indexes/s03.html @@ -24,7 +24,7 @@ </div> <div class="section"> <div class="titlepage"><div><div><h3 class="title"> -<a name="idm1549334256"></a>Typedef Index</h3></div></div></div> +<a name="idm1549381056"></a>Typedef Index</h3></div></div></div> <p><a class="link" href="s03.html#idx_id_40">C</a> <a class="link" href="s03.html#idx_id_43">F</a> <a class="link" href="s03.html#idx_id_45">I</a> <a class="link" href="s03.html#idx_id_46">L</a> <a class="link" href="s03.html#idx_id_47">M</a> <a class="link" href="s03.html#idx_id_52">S</a> <a class="link" href="s03.html#idx_id_53">T</a> <a class="link" href="s03.html#idx_id_54">U</a></p> <div class="variablelist"><dl class="variablelist"> <dt> diff --git a/libs/multiprecision/doc/html/boost_multiprecision/indexes/s04.html b/libs/multiprecision/doc/html/boost_multiprecision/indexes/s04.html index 860ab7ca0..5ed87b4e9 100644 --- a/libs/multiprecision/doc/html/boost_multiprecision/indexes/s04.html +++ b/libs/multiprecision/doc/html/boost_multiprecision/indexes/s04.html @@ -23,7 +23,7 @@ </div> <div class="section"> <div class="titlepage"><div><div><h3 class="title"> -<a name="idm1549203312"></a>Index</h3></div></div></div> +<a name="idm1549250240"></a>Index</h3></div></div></div> <p><a class="link" href="s04.html#idx_id_57">A</a> <a class="link" href="s04.html#idx_id_58">B</a> <a class="link" href="s04.html#idx_id_59">C</a> <a class="link" href="s04.html#idx_id_60">D</a> <a class="link" href="s04.html#idx_id_61">E</a> <a class="link" href="s04.html#idx_id_62">F</a> <a class="link" href="s04.html#idx_id_63">G</a> <a class="link" href="s04.html#idx_id_64">I</a> <a class="link" href="s04.html#idx_id_65">L</a> <a class="link" href="s04.html#idx_id_66">M</a> <a class="link" href="s04.html#idx_id_67">N</a> <a class="link" href="s04.html#idx_id_68">O</a> <a class="link" href="s04.html#idx_id_69">P</a> <a class="link" href="s04.html#idx_id_70">R</a> <a class="link" href="s04.html#idx_id_71">S</a> <a class="link" href="s04.html#idx_id_72">T</a> <a class="link" href="s04.html#idx_id_73">U</a> <a class="link" href="s04.html#idx_id_74">V</a> <a class="link" href="s04.html#idx_id_75">Z</a></p> <div class="variablelist"><dl class="variablelist"> <dt> @@ -550,6 +550,10 @@ <div class="index"><ul class="index" style="list-style-type: none; "><li class="listitem" style="list-style-type: none"><p><a class="link" href="../ref/backendconc.html#boost_multiprecision.ref.backendconc.optional_requirements_on_the_bac" title="Table 1.9. Optional Requirements on the Backend Type"><span class="index-entry-level-1">Optional Requirements on the Backend Type</span></a></p></li></ul></div> </li> <li class="listitem" style="list-style-type: none"> +<p><span class="index-entry-level-0">eval_scalbn</span></p> +<div class="index"><ul class="index" style="list-style-type: none; "><li class="listitem" style="list-style-type: none"><p><a class="link" href="../ref/backendconc.html#boost_multiprecision.ref.backendconc.optional_requirements_on_the_bac" title="Table 1.9. Optional Requirements on the Backend Type"><span class="index-entry-level-1">Optional Requirements on the Backend Type</span></a></p></li></ul></div> +</li> +<li class="listitem" style="list-style-type: none"> <p><span class="index-entry-level-0">eval_sin</span></p> <div class="index"><ul class="index" style="list-style-type: none; "><li class="listitem" style="list-style-type: none"><p><a class="link" href="../ref/backendconc.html#boost_multiprecision.ref.backendconc.optional_requirements_on_the_bac" title="Table 1.9. Optional Requirements on the Backend Type"><span class="index-entry-level-1">Optional Requirements on the Backend Type</span></a></p></li></ul></div> </li> @@ -682,6 +686,10 @@ <div class="index"><ul class="index" style="list-style-type: none; "><li class="listitem" style="list-style-type: none"><p><a class="link" href="../tut/primetest.html" title="Primality Testing"><span class="index-entry-level-1">Primality Testing</span></a></p></li></ul></div> </li> <li class="listitem" style="list-style-type: none"> +<p><span class="index-entry-level-0">ilogb</span></p> +<div class="index"><ul class="index" style="list-style-type: none; "><li class="listitem" style="list-style-type: none"><p><a class="link" href="../ref/number.html" title="number"><span class="index-entry-level-1">number</span></a></p></li></ul></div> +</li> +<li class="listitem" style="list-style-type: none"> <p><span class="index-entry-level-0">in</span></p> <div class="index"><ul class="index" style="list-style-type: none; "><li class="listitem" style="list-style-type: none"><p><a class="link" href="../tut/interval/mpfi.html" title="mpfi_float"><span class="index-entry-level-1">mpfi_float</span></a></p></li></ul></div> </li> @@ -1026,6 +1034,7 @@ <li class="listitem" style="list-style-type: none"><p><a class="link" href="../ref/number.html" title="number"><span class="index-entry-level-1">divide_qr</span></a></p></li> <li class="listitem" style="list-style-type: none"><p><a class="link" href="../ref/number.html" title="number"><span class="index-entry-level-1">expression_template_default</span></a></p></li> <li class="listitem" style="list-style-type: none"><p><a class="link" href="../ref/number.html" title="number"><span class="index-entry-level-1">fpclassify</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../ref/number.html" title="number"><span class="index-entry-level-1">ilogb</span></a></p></li> <li class="listitem" style="list-style-type: none"><p><a class="link" href="../ref/number.html" title="number"><span class="index-entry-level-1">integer_modulus</span></a></p></li> <li class="listitem" style="list-style-type: none"><p><a class="link" href="../ref/number.html" title="number"><span class="index-entry-level-1">iround</span></a></p></li> <li class="listitem" style="list-style-type: none"><p><a class="link" href="../ref/number.html" title="number"><span class="index-entry-level-1">isfinite</span></a></p></li> @@ -1111,6 +1120,7 @@ <li class="listitem" style="list-style-type: none"><p><a class="link" href="../ref/backendconc.html#boost_multiprecision.ref.backendconc.optional_requirements_on_the_bac" title="Table 1.9. Optional Requirements on the Backend Type"><span class="index-entry-level-1">eval_qr</span></a></p></li> <li class="listitem" style="list-style-type: none"><p><a class="link" href="../ref/backendconc.html#boost_multiprecision.ref.backendconc.optional_requirements_on_the_bac" title="Table 1.9. Optional Requirements on the Backend Type"><span class="index-entry-level-1">eval_right_shift</span></a></p></li> <li class="listitem" style="list-style-type: none"><p><a class="link" href="../ref/backendconc.html#boost_multiprecision.ref.backendconc.optional_requirements_on_the_bac" title="Table 1.9. Optional Requirements on the Backend Type"><span class="index-entry-level-1">eval_round</span></a></p></li> +<li class="listitem" style="list-style-type: none"><p><a class="link" href="../ref/backendconc.html#boost_multiprecision.ref.backendconc.optional_requirements_on_the_bac" title="Table 1.9. Optional Requirements on the Backend Type"><span class="index-entry-level-1">eval_scalbn</span></a></p></li> <li class="listitem" style="list-style-type: none"><p><a class="link" href="../ref/backendconc.html#boost_multiprecision.ref.backendconc.optional_requirements_on_the_bac" title="Table 1.9. Optional Requirements on the Backend Type"><span class="index-entry-level-1">eval_sin</span></a></p></li> <li class="listitem" style="list-style-type: none"><p><a class="link" href="../ref/backendconc.html#boost_multiprecision.ref.backendconc.optional_requirements_on_the_bac" title="Table 1.9. Optional Requirements on the Backend Type"><span class="index-entry-level-1">eval_sinh</span></a></p></li> <li class="listitem" style="list-style-type: none"><p><a class="link" href="../ref/backendconc.html#boost_multiprecision.ref.backendconc.optional_requirements_on_the_bac" title="Table 1.9. Optional Requirements on the Backend Type"><span class="index-entry-level-1">eval_subtract</span></a></p></li> diff --git a/libs/multiprecision/doc/html/boost_multiprecision/map/hist.html b/libs/multiprecision/doc/html/boost_multiprecision/map/hist.html index 71464dcab..c8469f448 100644 --- a/libs/multiprecision/doc/html/boost_multiprecision/map/hist.html +++ b/libs/multiprecision/doc/html/boost_multiprecision/map/hist.html @@ -28,6 +28,26 @@ </h3></div></div></div> <h5> <a name="boost_multiprecision.map.hist.h0"></a> + <span class="phrase"><a name="boost_multiprecision.map.hist.multiprecision_2_2_3_boost_1_57"></a></span><a class="link" href="hist.html#boost_multiprecision.map.hist.multiprecision_2_2_3_boost_1_57">Multiprecision-2.2.3 + (Boost-1.57)</a> + </h5> +<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "> +<li class="listitem"> + Changed rational to float conversions to exactly round to nearest, see + [https://svn.boost.org/trac/boost/ticket/10085 10085]. + </li> +<li class="listitem"> + Added improved generic float to rational conversions. + </li> +<li class="listitem"> + Fixed rare bug in exponent function for <a class="link" href="../tut/floats/cpp_bin_float.html" title="cpp_bin_float">cpp_bin_float</a>. + </li> +<li class="listitem"> + Fixed various minor documentation issues. + </li> +</ul></div> +<h5> +<a name="boost_multiprecision.map.hist.h1"></a> <span class="phrase"><a name="boost_multiprecision.map.hist.multiprecision_2_2_2_boost_1_56"></a></span><a class="link" href="hist.html#boost_multiprecision.map.hist.multiprecision_2_2_2_boost_1_56">Multiprecision-2.2.2 (Boost-1.56)</a> </h5> @@ -40,14 +60,14 @@ </li> </ul></div> <h5> -<a name="boost_multiprecision.map.hist.h1"></a> +<a name="boost_multiprecision.map.hist.h2"></a> <span class="phrase"><a name="boost_multiprecision.map.hist.multiprecision_2_2_1"></a></span><a class="link" href="hist.html#boost_multiprecision.map.hist.multiprecision_2_2_1">Multiprecision-2.2.1</a> </h5> <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"> Fix bug in assignment from string in cpp_int, see <a href="https://svn.boost.org/trac/boost/ticket/9936" target="_top">9936</a>. </li></ul></div> <h5> -<a name="boost_multiprecision.map.hist.h2"></a> +<a name="boost_multiprecision.map.hist.h3"></a> <span class="phrase"><a name="boost_multiprecision.map.hist.multiprecision_2_2_0"></a></span><a class="link" href="hist.html#boost_multiprecision.map.hist.multiprecision_2_2_0">Multiprecision-2.2.0</a> </h5> <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "> @@ -75,7 +95,7 @@ </li> </ul></div> <h5> -<a name="boost_multiprecision.map.hist.h3"></a> +<a name="boost_multiprecision.map.hist.h4"></a> <span class="phrase"><a name="boost_multiprecision.map.hist.boost_1_55"></a></span><a class="link" href="hist.html#boost_multiprecision.map.hist.boost_1_55">Boost-1.55</a> </h5> <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "> @@ -113,7 +133,7 @@ </li> </ul></div> <h5> -<a name="boost_multiprecision.map.hist.h4"></a> +<a name="boost_multiprecision.map.hist.h5"></a> <span class="phrase"><a name="boost_multiprecision.map.hist.1_54"></a></span><a class="link" href="hist.html#boost_multiprecision.map.hist.1_54">1.54</a> </h5> <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "> @@ -168,7 +188,7 @@ </li> </ul></div> <h5> -<a name="boost_multiprecision.map.hist.h5"></a> +<a name="boost_multiprecision.map.hist.h6"></a> <span class="phrase"><a name="boost_multiprecision.map.hist.1_53"></a></span><a class="link" href="hist.html#boost_multiprecision.map.hist.1_53">1.53</a> </h5> <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "> @@ -184,7 +204,7 @@ </li> </ul></div> <h5> -<a name="boost_multiprecision.map.hist.h6"></a> +<a name="boost_multiprecision.map.hist.h7"></a> <span class="phrase"><a name="boost_multiprecision.map.hist.post_review_changes"></a></span><a class="link" href="hist.html#boost_multiprecision.map.hist.post_review_changes">Post review changes</a> </h5> @@ -238,7 +258,7 @@ </li> </ul></div> <h5> -<a name="boost_multiprecision.map.hist.h7"></a> +<a name="boost_multiprecision.map.hist.h8"></a> <span class="phrase"><a name="boost_multiprecision.map.hist.pre_review_history"></a></span><a class="link" href="hist.html#boost_multiprecision.map.hist.pre_review_history">Pre-review history</a> </h5> diff --git a/libs/multiprecision/doc/html/boost_multiprecision/map/todo.html b/libs/multiprecision/doc/html/boost_multiprecision/map/todo.html index a295d9e4d..067af586b 100644 --- a/libs/multiprecision/doc/html/boost_multiprecision/map/todo.html +++ b/libs/multiprecision/doc/html/boost_multiprecision/map/todo.html @@ -38,18 +38,12 @@ Add an adaptor back-end for complex number types. </li> <li class="listitem"> - Add a back-end for MPFR interval arithmetic. - </li> -<li class="listitem"> Add better multiplication routines (Karatsuba, FFT etc) to cpp_int_backend. </li> <li class="listitem"> Add assembly level routines to cpp_int_backend. </li> <li class="listitem"> - Add an all C++ Boost licensed binary floating point type. - </li> -<li class="listitem"> Can ring types (exact floating point types) be supported? The answer should be yes, but someone needs to write it, the hard part is IO and binary-decimal conversion. diff --git a/libs/multiprecision/doc/html/boost_multiprecision/ref/backendconc.html b/libs/multiprecision/doc/html/boost_multiprecision/ref/backendconc.html index 3b2b415f9..ff86a64dd 100644 --- a/libs/multiprecision/doc/html/boost_multiprecision/ref/backendconc.html +++ b/libs/multiprecision/doc/html/boost_multiprecision/ref/backendconc.html @@ -960,7 +960,6 @@ <col> <col> <col> -<col> </colgroup> <thead><tr> <th> @@ -993,7 +992,6 @@ </td> <td class="auto-generated"> </td> <td class="auto-generated"> </td> -<td class="auto-generated"> </td> </tr> <tr> <td> @@ -1179,7 +1177,6 @@ </td> <td class="auto-generated"> </td> <td class="auto-generated"> </td> -<td class="auto-generated"> </td> </tr> <tr> <td> @@ -1478,7 +1475,6 @@ </td> <td class="auto-generated"> </td> <td class="auto-generated"> </td> -<td class="auto-generated"> </td> </tr> <tr> <td> @@ -2234,7 +2230,6 @@ </td> <td class="auto-generated"> </td> <td class="auto-generated"> </td> -<td class="auto-generated"> </td> </tr> <tr> <td> @@ -3293,7 +3288,6 @@ </td> <td class="auto-generated"> </td> <td class="auto-generated"> </td> -<td class="auto-generated"> </td> </tr> <tr> <td> @@ -3361,7 +3355,6 @@ </td> <td class="auto-generated"> </td> <td class="auto-generated"> </td> -<td class="auto-generated"> </td> </tr> <tr> <td> @@ -3870,6 +3863,72 @@ </p> </td> </tr> +<tr> +<td> + <p> + <code class="computeroutput"><span class="identifier">eval_scalbn</span><span class="special">(</span><span class="identifier">b</span><span class="special">,</span> + <span class="identifier">cb</span><span class="special">,</span> + <span class="identifier">e</span><span class="special">)</span></code> + </p> + </td> +<td> + <p> + <code class="computeroutput"><span class="keyword">void</span></code> + </p> + </td> +<td> + <p> + Scales value <code class="computeroutput"><span class="identifier">cb</span></code> + by <span class="emphasis"><em>r<sup>e</sup></em></span>, where <span class="emphasis"><em>r</em></span> is the + radix of the type. The default version of this function is implemented + in terms of eval_ldexp, consequently this function must be provided + for types with a radix other than 2. + </p> + </td> +</tr> +<tr> +<td> + <p> + <code class="computeroutput"><span class="identifier">eval_ilogb</span><span class="special">(</span><span class="identifier">cb</span><span class="special">)</span></code> + </p> + </td> +<td> + <p> + <code class="computeroutput"><span class="identifier">B</span><span class="special">::</span><span class="identifier">exponent_type</span></code> + </p> + </td> +<td> + <p> + Returns the exponent <span class="emphasis"><em>e</em></span> of value <code class="computeroutput"><span class="identifier">cb</span></code> such that <span class="emphasis"><em>1 <= + cb*r<sup>-e</sup> < r</em></span>, where <span class="emphasis"><em>r</em></span> is the radix + of type B. The default version of this function is implemented + in terms of eval_frexp, consequently this function must be provided + for types with a radix other than 2. + </p> + </td> +</tr> +<tr> +<td> + <p> + <code class="computeroutput"><span class="identifier">eval_logb</span><span class="special">(</span><span class="identifier">b</span><span class="special">,</span> + <span class="identifier">cb</span><span class="special">)</span></code> + </p> + </td> +<td> + <p> + <code class="computeroutput"><span class="identifier">B</span><span class="special">::</span><span class="identifier">exponent_type</span></code> + </p> + </td> +<td> + <p> + Sets <code class="computeroutput"><span class="identifier">b</span></code> to the exponent + <span class="emphasis"><em>e</em></span> of value <code class="computeroutput"><span class="identifier">cb</span></code> + such that <span class="emphasis"><em>1 <= cb*r<sup>-b</sup> < r</em></span>, where <span class="emphasis"><em>r</em></span> + is the radix of type B. The default version of this function is + implemented in terms of <code class="computeroutput"><span class="identifier">eval_ilogb</span></code>. + </p> + </td> +</tr> </tbody> </table></div> </div> diff --git a/libs/multiprecision/doc/html/boost_multiprecision/ref/number.html b/libs/multiprecision/doc/html/boost_multiprecision/ref/number.html index f0bfd5cfc..b272c7d98 100644 --- a/libs/multiprecision/doc/html/boost_multiprecision/ref/number.html +++ b/libs/multiprecision/doc/html/boost_multiprecision/ref/number.html @@ -159,11 +159,14 @@ <span class="emphasis"><em>unmentionable-expression-template-type</em></span> <span class="identifier">sinh</span> <span class="special">(</span><span class="keyword">const</span> <span class="emphasis"><em>number-or-expression-template-type</em></span><span class="special">&);</span> <span class="emphasis"><em>unmentionable-expression-template-type</em></span> <span class="identifier">tanh</span> <span class="special">(</span><span class="keyword">const</span> <span class="emphasis"><em>number-or-expression-template-type</em></span><span class="special">&);</span> -<span class="emphasis"><em>unmentionable-expression-template-type</em></span> <span class="identifier">ldexp</span> <span class="special">(</span><span class="keyword">const</span> <span class="emphasis"><em>number-or-expression-template-type</em></span><span class="special">&,</span> <span class="keyword">int</span><span class="special">);</span> -<span class="emphasis"><em>unmentionable-expression-template-type</em></span> <span class="identifier">frexp</span> <span class="special">(</span><span class="keyword">const</span> <span class="emphasis"><em>number-or-expression-template-type</em></span><span class="special">&,</span> <span class="keyword">int</span><span class="special">*);</span> +<span class="emphasis"><em>unmentionable-expression-template-type</em></span> <span class="identifier">ldexp</span> <span class="special">(</span><span class="keyword">const</span> <span class="emphasis"><em>number-or-expression-template-type</em></span><span class="special">&,</span> <span class="emphasis"><em>integer-type</em></span><span class="special">);</span> +<span class="emphasis"><em>unmentionable-expression-template-type</em></span> <span class="identifier">frexp</span> <span class="special">(</span><span class="keyword">const</span> <span class="emphasis"><em>number-or-expression-template-type</em></span><span class="special">&,</span> <span class="emphasis"><em>integer-type</em></span><span class="special">*);</span> <span class="emphasis"><em>unmentionable-expression-template-type</em></span> <span class="identifier">pow</span> <span class="special">(</span><span class="keyword">const</span> <span class="emphasis"><em>number-or-expression-template-type</em></span><span class="special">&,</span> <span class="keyword">const</span> <span class="emphasis"><em>number-or-expression-template-type</em></span><span class="special">&);</span> <span class="emphasis"><em>unmentionable-expression-template-type</em></span> <span class="identifier">fmod</span> <span class="special">(</span><span class="keyword">const</span> <span class="emphasis"><em>number-or-expression-template-type</em></span><span class="special">&,</span> <span class="keyword">const</span> <span class="emphasis"><em>number-or-expression-template-type</em></span><span class="special">&);</span> <span class="emphasis"><em>unmentionable-expression-template-type</em></span> <span class="identifier">atan2</span> <span class="special">(</span><span class="keyword">const</span> <span class="emphasis"><em>number-or-expression-template-type</em></span><span class="special">&,</span> <span class="keyword">const</span> <span class="emphasis"><em>number-or-expression-template-type</em></span><span class="special">&);</span> +<span class="emphasis"><em>unmentionable-expression-template-type</em></span> <span class="identifier">scalbn</span><span class="special">(</span><span class="keyword">const</span> <span class="emphasis"><em>number-or-expression-template-type</em></span><span class="special">&,</span> <span class="emphasis"><em>integer-type</em></span><span class="special">);</span> +<span class="emphasis"><em>unmentionable-expression-template-type</em></span> <span class="identifier">logb</span> <span class="special">(</span><span class="keyword">const</span> <span class="emphasis"><em>number-or-expression-template-type</em></span><span class="special">&);</span> +<span class="emphasis"><em>integer-type</em></span> <span class="identifier">ilogb</span> <span class="special">(</span><span class="keyword">const</span> <span class="emphasis"><em>number-or-expression-template-type</em></span><span class="special">&);</span> <span class="comment">// Traits support:</span> <span class="keyword">template</span> <span class="special"><</span><span class="keyword">class</span> <span class="identifier">T</span><span class="special">></span> @@ -652,11 +655,14 @@ <span class="emphasis"><em>unmentionable-expression-template-type</em></span> <span class="identifier">sinh</span> <span class="special">(</span><span class="keyword">const</span> <span class="emphasis"><em>number-or-expression-template-type</em></span><span class="special">&);</span> <span class="emphasis"><em>unmentionable-expression-template-type</em></span> <span class="identifier">tanh</span> <span class="special">(</span><span class="keyword">const</span> <span class="emphasis"><em>number-or-expression-template-type</em></span><span class="special">&);</span> -<span class="emphasis"><em>unmentionable-expression-template-type</em></span> <span class="identifier">ldexp</span> <span class="special">(</span><span class="keyword">const</span> <span class="emphasis"><em>number-or-expression-template-type</em></span><span class="special">&,</span> <span class="keyword">int</span><span class="special">);</span> -<span class="emphasis"><em>unmentionable-expression-template-type</em></span> <span class="identifier">frexp</span> <span class="special">(</span><span class="keyword">const</span> <span class="emphasis"><em>number-or-expression-template-type</em></span><span class="special">&,</span> <span class="keyword">int</span><span class="special">*);</span> +<span class="emphasis"><em>unmentionable-expression-template-type</em></span> <span class="identifier">ldexp</span> <span class="special">(</span><span class="keyword">const</span> <span class="emphasis"><em>number-or-expression-template-type</em></span><span class="special">&,</span> <span class="emphasis"><em>integer-type</em></span><span class="special">);</span> +<span class="emphasis"><em>unmentionable-expression-template-type</em></span> <span class="identifier">frexp</span> <span class="special">(</span><span class="keyword">const</span> <span class="emphasis"><em>number-or-expression-template-type</em></span><span class="special">&,</span> <span class="emphasis"><em>integer-type</em></span><span class="special">*);</span> <span class="emphasis"><em>unmentionable-expression-template-type</em></span> <span class="identifier">pow</span> <span class="special">(</span><span class="keyword">const</span> <span class="emphasis"><em>number-or-expression-template-type</em></span><span class="special">&,</span> <span class="keyword">const</span> <span class="emphasis"><em>number-or-expression-template-type</em></span><span class="special">&);</span> <span class="emphasis"><em>unmentionable-expression-template-type</em></span> <span class="identifier">fmod</span> <span class="special">(</span><span class="keyword">const</span> <span class="emphasis"><em>number-or-expression-template-type</em></span><span class="special">&,</span> <span class="keyword">const</span> <span class="emphasis"><em>number-or-expression-template-type</em></span><span class="special">&);</span> <span class="emphasis"><em>unmentionable-expression-template-type</em></span> <span class="identifier">atan2</span> <span class="special">(</span><span class="keyword">const</span> <span class="emphasis"><em>number-or-expression-template-type</em></span><span class="special">&,</span> <span class="keyword">const</span> <span class="emphasis"><em>number-or-expression-template-type</em></span><span class="special">&);</span> +<span class="emphasis"><em>unmentionable-expression-template-type</em></span> <span class="identifier">scalbn</span><span class="special">(</span><span class="keyword">const</span> <span class="emphasis"><em>number-or-expression-template-type</em></span><span class="special">&,</span> <span class="emphasis"><em>integer-type</em></span><span class="special">);</span> +<span class="emphasis"><em>unmentionable-expression-template-type</em></span> <span class="identifier">logb</span> <span class="special">(</span><span class="keyword">const</span> <span class="emphasis"><em>number-or-expression-template-type</em></span><span class="special">&);</span> +<span class="emphasis"><em>integer-type</em></span> <span class="identifier">ilogb</span> <span class="special">(</span><span class="keyword">const</span> <span class="emphasis"><em>number-or-expression-template-type</em></span><span class="special">&);</span> </pre> <p> These functions all behave exactly as their standard library C++11 counterparts @@ -666,6 +672,13 @@ template. </p> <p> + The integer type arguments to <code class="computeroutput"><span class="identifier">ldexp</span></code>, + <code class="computeroutput"><span class="identifier">frexp</span></code>, <code class="computeroutput"><span class="identifier">scalbn</span></code> + and <code class="computeroutput"><span class="identifier">ilogb</span></code> may be either type + <code class="computeroutput"><span class="keyword">int</span></code>, or the actual type of the + exponent of the number type. + </p> +<p> These functions are normally implemented by the Backend type. However, default versions are provided for Backend types that don't have native support for these functions. Please note however, that this default support requires diff --git a/libs/multiprecision/doc/html/boost_multiprecision/tut/conversions.html b/libs/multiprecision/doc/html/boost_multiprecision/tut/conversions.html index deea68548..1550ecef0 100644 --- a/libs/multiprecision/doc/html/boost_multiprecision/tut/conversions.html +++ b/libs/multiprecision/doc/html/boost_multiprecision/tut/conversions.html @@ -65,6 +65,21 @@ <span class="keyword">int</span> <span class="identifier">i</span> <span class="special">=</span> <span class="identifier">z</span><span class="special">.</span><span class="keyword">template</span> <span class="identifier">convert_to</span><span class="special"><</span><span class="keyword">int</span><span class="special">>();</span> <span class="comment">// sets i to 2</span> </pre> </li> +<li class="listitem"> + Conversions to rational numbers from floating point ones are always allowed, + and are exact and implicit as long as the rational number uses an unbounded + integer type. Please be aware that constructing a rational number from + an extended precision floating point type with a large exponent range + can effectively run the system out of memory, as in the extreme case + <span class="emphasis"><em>2<sup>max_exponent</sup> / CHAR_BITS</em></span> bytes of storage may be + required. This does not represent a problem for built in floating point + types however, as the exponent range for these is rather limited. + </li> +<li class="listitem"> + Conversions to floating point numbers from rational ones are rounded + to nearest (less than 0.5ulp error) as long as the floating point number + is binary, and the integer type used by the rational number is unbounded. + </li> </ul></div> <p> Additional conversions may be supported by particular backends. diff --git a/libs/multiprecision/doc/html/boost_multiprecision/tut/floats/cpp_bin_float.html b/libs/multiprecision/doc/html/boost_multiprecision/tut/floats/cpp_bin_float.html index 5e9b60920..ea235149e 100644 --- a/libs/multiprecision/doc/html/boost_multiprecision/tut/floats/cpp_bin_float.html +++ b/libs/multiprecision/doc/html/boost_multiprecision/tut/floats/cpp_bin_float.html @@ -157,23 +157,29 @@ example:</a> </h6> <pre class="programlisting"><span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">multiprecision</span><span class="special">/</span><span class="identifier">cpp_bin_float</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span> +<span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">math</span><span class="special">/</span><span class="identifier">special_functions</span><span class="special">/</span><span class="identifier">gamma</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span> +<span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">iostream</span><span class="special">></span> -<span class="keyword">using</span> <span class="keyword">namespace</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">multiprecision</span><span class="special">;</span> +<span class="keyword">int</span> <span class="identifier">main</span><span class="special">()</span> +<span class="special">{</span> + <span class="keyword">using</span> <span class="keyword">namespace</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">multiprecision</span><span class="special">;</span> -<span class="comment">// Operations at fixed precision and full numeric_limits support:</span> -<span class="identifier">cpp_bin_float_100</span> <span class="identifier">b</span> <span class="special">=</span> <span class="number">2</span><span class="special">;</span> -<span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">numeric_limits</span><span class="special"><</span><span class="identifier">cpp_bin_float_100</span><span class="special">>::</span><span class="identifier">digits</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span> -<span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">numeric_limits</span><span class="special"><</span><span class="identifier">cpp_bin_float_100</span><span class="special">>::</span><span class="identifier">digits10</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span> -<span class="comment">// We can use any C++ std lib function, lets print all the digits as well:</span> -<span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">setprecision</span><span class="special">(</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">numeric_limits</span><span class="special"><</span><span class="identifier">cpp_bin_float_100</span><span class="special">>::</span><span class="identifier">max_digits10</span><span class="special">)</span> - <span class="special"><<</span> <span class="identifier">log</span><span class="special">(</span><span class="identifier">b</span><span class="special">)</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span> <span class="comment">// print log(2)</span> -<span class="comment">// We can also use any function from Boost.Math:</span> -<span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">math</span><span class="special">::</span><span class="identifier">tgamma</span><span class="special">(</span><span class="identifier">b</span><span class="special">)</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span> -<span class="comment">// These even work when the argument is an expression template:</span> -<span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">math</span><span class="special">::</span><span class="identifier">tgamma</span><span class="special">(</span><span class="identifier">b</span> <span class="special">*</span> <span class="identifier">b</span><span class="special">)</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span> -<span class="comment">// And since we have an extended exponent range we can generate some really large </span> -<span class="comment">// numbers here (4.0238726007709377354370243e+2564):</span> -<span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">math</span><span class="special">::</span><span class="identifier">tgamma</span><span class="special">(</span><span class="identifier">cpp_bin_float_100</span><span class="special">(</span><span class="number">1000</span><span class="special">))</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span> + <span class="comment">// Operations at fixed precision and full numeric_limits support:</span> + <span class="identifier">cpp_bin_float_100</span> <span class="identifier">b</span> <span class="special">=</span> <span class="number">2</span><span class="special">;</span> + <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">numeric_limits</span><span class="special"><</span><span class="identifier">cpp_bin_float_100</span><span class="special">>::</span><span class="identifier">digits</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span> + <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">numeric_limits</span><span class="special"><</span><span class="identifier">cpp_bin_float_100</span><span class="special">>::</span><span class="identifier">digits10</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span> + <span class="comment">// We can use any C++ std lib function, lets print all the digits as well:</span> + <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">setprecision</span><span class="special">(</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">numeric_limits</span><span class="special"><</span><span class="identifier">cpp_bin_float_100</span><span class="special">>::</span><span class="identifier">max_digits10</span><span class="special">)</span> + <span class="special"><<</span> <span class="identifier">log</span><span class="special">(</span><span class="identifier">b</span><span class="special">)</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span> <span class="comment">// print log(2)</span> + <span class="comment">// We can also use any function from Boost.Math:</span> + <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">math</span><span class="special">::</span><span class="identifier">tgamma</span><span class="special">(</span><span class="identifier">b</span><span class="special">)</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span> + <span class="comment">// These even work when the argument is an expression template:</span> + <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">math</span><span class="special">::</span><span class="identifier">tgamma</span><span class="special">(</span><span class="identifier">b</span> <span class="special">*</span> <span class="identifier">b</span><span class="special">)</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span> + <span class="comment">// And since we have an extended exponent range we can generate some really large </span> + <span class="comment">// numbers here (4.0238726007709377354370243e+2564):</span> + <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">math</span><span class="special">::</span><span class="identifier">tgamma</span><span class="special">(</span><span class="identifier">cpp_bin_float_100</span><span class="special">(</span><span class="number">1000</span><span class="special">))</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span> + <span class="keyword">return</span> <span class="number">0</span><span class="special">;</span> +<span class="special">}</span> </pre> </div> <table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr> diff --git a/libs/multiprecision/doc/html/boost_multiprecision/tut/floats/cpp_dec_float.html b/libs/multiprecision/doc/html/boost_multiprecision/tut/floats/cpp_dec_float.html index fe8d0e032..09f5c827d 100644 --- a/libs/multiprecision/doc/html/boost_multiprecision/tut/floats/cpp_dec_float.html +++ b/libs/multiprecision/doc/html/boost_multiprecision/tut/floats/cpp_dec_float.html @@ -134,24 +134,30 @@ example:</a> </h6> <pre class="programlisting"><span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">multiprecision</span><span class="special">/</span><span class="identifier">cpp_dec_float</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span> +<span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">math</span><span class="special">/</span><span class="identifier">special_functions</span><span class="special">/</span><span class="identifier">gamma</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span> +<span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">iostream</span><span class="special">></span> -<span class="keyword">using</span> <span class="keyword">namespace</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">multiprecision</span><span class="special">;</span> +<span class="keyword">int</span> <span class="identifier">main</span><span class="special">()</span> +<span class="special">{</span> + <span class="keyword">using</span> <span class="keyword">namespace</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">multiprecision</span><span class="special">;</span> -<span class="comment">// Operations at fixed precision and full numeric_limits support:</span> -<span class="identifier">cpp_dec_float_100</span> <span class="identifier">b</span> <span class="special">=</span> <span class="number">2</span><span class="special">;</span> -<span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">numeric_limits</span><span class="special"><</span><span class="identifier">cpp_dec_float_100</span><span class="special">>::</span><span class="identifier">digits</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span> -<span class="comment">// Note that digits10 is the same as digits, since we're base 10! :</span> -<span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">numeric_limits</span><span class="special"><</span><span class="identifier">cpp_dec_float_100</span><span class="special">>::</span><span class="identifier">digits10</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span> -<span class="comment">// We can use any C++ std lib function, lets print all the digits as well:</span> -<span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">setprecision</span><span class="special">(</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">numeric_limits</span><span class="special"><</span><span class="identifier">cpp_dec_float_100</span><span class="special">>::</span><span class="identifier">max_digits10</span><span class="special">)</span> - <span class="special"><<</span> <span class="identifier">log</span><span class="special">(</span><span class="identifier">b</span><span class="special">)</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span> <span class="comment">// print log(2)</span> -<span class="comment">// We can also use any function from Boost.Math:</span> -<span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">math</span><span class="special">::</span><span class="identifier">tgamma</span><span class="special">(</span><span class="identifier">b</span><span class="special">)</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span> -<span class="comment">// These even work when the argument is an expression template:</span> -<span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">math</span><span class="special">::</span><span class="identifier">tgamma</span><span class="special">(</span><span class="identifier">b</span> <span class="special">*</span> <span class="identifier">b</span><span class="special">)</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span> -<span class="comment">// And since we have an extended exponent range we can generate some really large </span> -<span class="comment">// numbers here (4.0238726007709377354370243e+2564):</span> -<span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">math</span><span class="special">::</span><span class="identifier">tgamma</span><span class="special">(</span><span class="identifier">cpp_dec_float_100</span><span class="special">(</span><span class="number">1000</span><span class="special">))</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span> + <span class="comment">// Operations at fixed precision and full numeric_limits support:</span> + <span class="identifier">cpp_dec_float_100</span> <span class="identifier">b</span> <span class="special">=</span> <span class="number">2</span><span class="special">;</span> + <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">numeric_limits</span><span class="special"><</span><span class="identifier">cpp_dec_float_100</span><span class="special">>::</span><span class="identifier">digits</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span> + <span class="comment">// Note that digits10 is the same as digits, since we're base 10! :</span> + <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">numeric_limits</span><span class="special"><</span><span class="identifier">cpp_dec_float_100</span><span class="special">>::</span><span class="identifier">digits10</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span> + <span class="comment">// We can use any C++ std lib function, lets print all the digits as well:</span> + <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">setprecision</span><span class="special">(</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">numeric_limits</span><span class="special"><</span><span class="identifier">cpp_dec_float_100</span><span class="special">>::</span><span class="identifier">max_digits10</span><span class="special">)</span> + <span class="special"><<</span> <span class="identifier">log</span><span class="special">(</span><span class="identifier">b</span><span class="special">)</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span> <span class="comment">// print log(2)</span> + <span class="comment">// We can also use any function from Boost.Math:</span> + <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">math</span><span class="special">::</span><span class="identifier">tgamma</span><span class="special">(</span><span class="identifier">b</span><span class="special">)</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span> + <span class="comment">// These even work when the argument is an expression template:</span> + <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">math</span><span class="special">::</span><span class="identifier">tgamma</span><span class="special">(</span><span class="identifier">b</span> <span class="special">*</span> <span class="identifier">b</span><span class="special">)</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span> + <span class="comment">// And since we have an extended exponent range we can generate some really large </span> + <span class="comment">// numbers here (4.0238726007709377354370243e+2564):</span> + <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">math</span><span class="special">::</span><span class="identifier">tgamma</span><span class="special">(</span><span class="identifier">cpp_dec_float_100</span><span class="special">(</span><span class="number">1000</span><span class="special">))</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span> + <span class="keyword">return</span> <span class="number">0</span><span class="special">;</span> +<span class="special">}</span> </pre> </div> <table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr> diff --git a/libs/multiprecision/doc/html/boost_multiprecision/tut/floats/float128.html b/libs/multiprecision/doc/html/boost_multiprecision/tut/floats/float128.html index 428dbf7e5..e4ba6f389 100644 --- a/libs/multiprecision/doc/html/boost_multiprecision/tut/floats/float128.html +++ b/libs/multiprecision/doc/html/boost_multiprecision/tut/floats/float128.html @@ -113,28 +113,35 @@ example:</a> </h6> <pre class="programlisting"><span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">multiprecision</span><span class="special">/</span><span class="identifier">float128</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span> +<span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">math</span><span class="special">/</span><span class="identifier">special_functions</span><span class="special">/</span><span class="identifier">gamma</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span> +<span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">iostream</span><span class="special">></span> -<span class="keyword">using</span> <span class="keyword">namespace</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">multiprecision</span><span class="special">;</span> +<span class="keyword">int</span> <span class="identifier">main</span><span class="special">()</span> +<span class="special">{</span> + <span class="keyword">using</span> <span class="keyword">namespace</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">multiprecision</span><span class="special">;</span> -<span class="comment">// Operations at 128-bit precision and full numeric_limits support:</span> -<span class="identifier">float128</span> <span class="identifier">b</span> <span class="special">=</span> <span class="number">2</span><span class="special">;</span> -<span class="comment">// There are 113-bits of precision:</span> -<span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">numeric_limits</span><span class="special"><</span><span class="identifier">float128</span><span class="special">>::</span><span class="identifier">digits</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span> -<span class="comment">// Or 34 decimal places:</span> -<span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">numeric_limits</span><span class="special"><</span><span class="identifier">float128</span><span class="special">>::</span><span class="identifier">digits10</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span> -<span class="comment">// We can use any C++ std lib function, lets print all the digits as well:</span> -<span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">setprecision</span><span class="special">(</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">numeric_limits</span><span class="special"><</span><span class="identifier">float128</span><span class="special">>::</span><span class="identifier">max_digits10</span><span class="special">)</span> - <span class="special"><<</span> <span class="identifier">log</span><span class="special">(</span><span class="identifier">b</span><span class="special">)</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span> <span class="comment">// print log(2) = 0.693147180559945309417232121458176575</span> -<span class="comment">// We can also use any function from Boost.Math:</span> -<span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">math</span><span class="special">::</span><span class="identifier">tgamma</span><span class="special">(</span><span class="identifier">b</span><span class="special">)</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span> -<span class="comment">// And since we have an extended exponent range we can generate some really large </span> -<span class="comment">// numbers here (4.02387260077093773543702433923004111e+2564):</span> -<span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">math</span><span class="special">::</span><span class="identifier">tgamma</span><span class="special">(</span><span class="identifier">float128</span><span class="special">(</span><span class="number">1000</span><span class="special">))</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span> -<span class="comment">//</span> -<span class="comment">// We can declare constants using GCC or Intel's native types, and the Q suffix,</span> -<span class="comment">// these can be declared constexpr if required:</span> + <span class="comment">// Operations at 128-bit precision and full numeric_limits support:</span> + <span class="identifier">float128</span> <span class="identifier">b</span> <span class="special">=</span> <span class="number">2</span><span class="special">;</span> + <span class="comment">// There are 113-bits of precision:</span> + <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">numeric_limits</span><span class="special"><</span><span class="identifier">float128</span><span class="special">>::</span><span class="identifier">digits</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span> + <span class="comment">// Or 34 decimal places:</span> + <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">numeric_limits</span><span class="special"><</span><span class="identifier">float128</span><span class="special">>::</span><span class="identifier">digits10</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span> + <span class="comment">// We can use any C++ std lib function, lets print all the digits as well:</span> + <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">setprecision</span><span class="special">(</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">numeric_limits</span><span class="special"><</span><span class="identifier">float128</span><span class="special">>::</span><span class="identifier">max_digits10</span><span class="special">)</span> + <span class="special"><<</span> <span class="identifier">log</span><span class="special">(</span><span class="identifier">b</span><span class="special">)</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span> <span class="comment">// print log(2) = 0.693147180559945309417232121458176575</span> + <span class="comment">// We can also use any function from Boost.Math:</span> + <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">math</span><span class="special">::</span><span class="identifier">tgamma</span><span class="special">(</span><span class="identifier">b</span><span class="special">)</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span> + <span class="comment">// And since we have an extended exponent range we can generate some really large </span> + <span class="comment">// numbers here (4.02387260077093773543702433923004111e+2564):</span> + <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">math</span><span class="special">::</span><span class="identifier">tgamma</span><span class="special">(</span><span class="identifier">float128</span><span class="special">(</span><span class="number">1000</span><span class="special">))</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span> + <span class="comment">//</span> + <span class="comment">// We can declare constants using GCC or Intel's native types, and the Q suffix,</span> + <span class="comment">// these can be declared constexpr if required:</span> -<span class="keyword">constexpr</span> <span class="identifier">float128</span> <span class="identifier">pi</span> <span class="special">=</span> <span class="number">3.1415926535897932384626433832795028841971693993751058</span><span class="identifier">Q</span><span class="special">;</span> + <span class="keyword">constexpr</span> <span class="identifier">float128</span> <span class="identifier">pi</span> <span class="special">=</span> <span class="number">3.1415926535897932384626433832795028841971693993751058</span><span class="identifier">Q</span><span class="special">;</span> + + <span class="keyword">return</span> <span class="number">0</span><span class="special">;</span> +<span class="special">}</span> </pre> <div class="footnotes"> <br><hr style="width:100; text-align:left;margin-left: 0"> diff --git a/libs/multiprecision/doc/html/boost_multiprecision/tut/floats/gmp_float.html b/libs/multiprecision/doc/html/boost_multiprecision/tut/floats/gmp_float.html index 8218dc9d0..748ab6ff8 100644 --- a/libs/multiprecision/doc/html/boost_multiprecision/tut/floats/gmp_float.html +++ b/libs/multiprecision/doc/html/boost_multiprecision/tut/floats/gmp_float.html @@ -146,29 +146,36 @@ <span class="phrase"><a name="boost_multiprecision.tut.floats.gmp_float.gmp_example"></a></span><a class="link" href="gmp_float.html#boost_multiprecision.tut.floats.gmp_float.gmp_example"> GMP example:</a> </h6> <pre class="programlisting"><span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">multiprecision</span><span class="special">/</span><span class="identifier">gmp</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span> +<span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">math</span><span class="special">/</span><span class="identifier">special_functions</span><span class="special">/</span><span class="identifier">gamma</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span> +<span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">iostream</span><span class="special">></span> -<span class="keyword">using</span> <span class="keyword">namespace</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">multiprecision</span><span class="special">;</span> +<span class="keyword">int</span> <span class="identifier">main</span><span class="special">()</span> +<span class="special">{</span> + <span class="keyword">using</span> <span class="keyword">namespace</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">multiprecision</span><span class="special">;</span> -<span class="comment">// Operations at variable precision and limited standard library support:</span> -<span class="identifier">mpf_float</span> <span class="identifier">a</span> <span class="special">=</span> <span class="number">2</span><span class="special">;</span> -<span class="identifier">mpf_float</span><span class="special">::</span><span class="identifier">default_precision</span><span class="special">(</span><span class="number">1000</span><span class="special">);</span> -<span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="identifier">mpf_float</span><span class="special">::</span><span class="identifier">default_precision</span><span class="special">()</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span> -<span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="identifier">sqrt</span><span class="special">(</span><span class="identifier">a</span><span class="special">)</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span> <span class="comment">// print root-2</span> + <span class="comment">// Operations at variable precision and limited standard library support:</span> + <span class="identifier">mpf_float</span> <span class="identifier">a</span> <span class="special">=</span> <span class="number">2</span><span class="special">;</span> + <span class="identifier">mpf_float</span><span class="special">::</span><span class="identifier">default_precision</span><span class="special">(</span><span class="number">1000</span><span class="special">);</span> + <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="identifier">mpf_float</span><span class="special">::</span><span class="identifier">default_precision</span><span class="special">()</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span> + <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="identifier">sqrt</span><span class="special">(</span><span class="identifier">a</span><span class="special">)</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span> <span class="comment">// print root-2</span> -<span class="comment">// Operations at fixed precision and full standard library support:</span> -<span class="identifier">mpf_float_100</span> <span class="identifier">b</span> <span class="special">=</span> <span class="number">2</span><span class="special">;</span> -<span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">numeric_limits</span><span class="special"><</span><span class="identifier">mpf_float_100</span><span class="special">>::</span><span class="identifier">digits</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span> -<span class="comment">// We can use any C++ std lib function:</span> -<span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="identifier">log</span><span class="special">(</span><span class="identifier">b</span><span class="special">)</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span> <span class="comment">// print log(2)</span> -<span class="comment">// We can also use any function from Boost.Math:</span> -<span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">math</span><span class="special">::</span><span class="identifier">tgamma</span><span class="special">(</span><span class="identifier">b</span><span class="special">)</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span> -<span class="comment">// These even work when the argument is an expression template:</span> -<span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">math</span><span class="special">::</span><span class="identifier">tgamma</span><span class="special">(</span><span class="identifier">b</span> <span class="special">*</span> <span class="identifier">b</span><span class="special">)</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span> + <span class="comment">// Operations at fixed precision and full standard library support:</span> + <span class="identifier">mpf_float_100</span> <span class="identifier">b</span> <span class="special">=</span> <span class="number">2</span><span class="special">;</span> + <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">numeric_limits</span><span class="special"><</span><span class="identifier">mpf_float_100</span><span class="special">>::</span><span class="identifier">digits</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span> + <span class="comment">// We can use any C++ std lib function:</span> + <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="identifier">log</span><span class="special">(</span><span class="identifier">b</span><span class="special">)</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span> <span class="comment">// print log(2)</span> + <span class="comment">// We can also use any function from Boost.Math:</span> + <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">math</span><span class="special">::</span><span class="identifier">tgamma</span><span class="special">(</span><span class="identifier">b</span><span class="special">)</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span> + <span class="comment">// These even work when the argument is an expression template:</span> + <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">math</span><span class="special">::</span><span class="identifier">tgamma</span><span class="special">(</span><span class="identifier">b</span> <span class="special">*</span> <span class="identifier">b</span><span class="special">)</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span> -<span class="comment">// Access the underlying representation:</span> -<span class="identifier">mpf_t</span> <span class="identifier">f</span><span class="special">;</span> -<span class="identifier">mpf_init</span><span class="special">(</span><span class="identifier">f</span><span class="special">);</span> -<span class="identifier">mpf_set</span><span class="special">(</span><span class="identifier">f</span><span class="special">,</span> <span class="identifier">a</span><span class="special">.</span><span class="identifier">backend</span><span class="special">().</span><span class="identifier">data</span><span class="special">());</span> + <span class="comment">// Access the underlying representation:</span> + <span class="identifier">mpf_t</span> <span class="identifier">f</span><span class="special">;</span> + <span class="identifier">mpf_init</span><span class="special">(</span><span class="identifier">f</span><span class="special">);</span> + <span class="identifier">mpf_set</span><span class="special">(</span><span class="identifier">f</span><span class="special">,</span> <span class="identifier">a</span><span class="special">.</span><span class="identifier">backend</span><span class="special">().</span><span class="identifier">data</span><span class="special">());</span> + <span class="identifier">mpf_clear</span><span class="special">(</span><span class="identifier">f</span><span class="special">);</span> + <span class="keyword">return</span> <span class="number">0</span><span class="special">;</span> +<span class="special">}</span> </pre> </div> <table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr> diff --git a/libs/multiprecision/doc/html/boost_multiprecision/tut/floats/mpfr_float.html b/libs/multiprecision/doc/html/boost_multiprecision/tut/floats/mpfr_float.html index f405f0af0..3acd47f14 100644 --- a/libs/multiprecision/doc/html/boost_multiprecision/tut/floats/mpfr_float.html +++ b/libs/multiprecision/doc/html/boost_multiprecision/tut/floats/mpfr_float.html @@ -229,29 +229,36 @@ <span class="phrase"><a name="boost_multiprecision.tut.floats.mpfr_float.mpfr_example"></a></span><a class="link" href="mpfr_float.html#boost_multiprecision.tut.floats.mpfr_float.mpfr_example"> MPFR example:</a> </h6> <pre class="programlisting"><span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">multiprecision</span><span class="special">/</span><span class="identifier">mpfr</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span> +<span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">math</span><span class="special">/</span><span class="identifier">special_functions</span><span class="special">/</span><span class="identifier">gamma</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span> +<span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">iostream</span><span class="special">></span> -<span class="keyword">using</span> <span class="keyword">namespace</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">multiprecision</span><span class="special">;</span> +<span class="keyword">int</span> <span class="identifier">main</span><span class="special">()</span> +<span class="special">{</span> + <span class="keyword">using</span> <span class="keyword">namespace</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">multiprecision</span><span class="special">;</span> -<span class="comment">// Operations at variable precision and no numeric_limits support:</span> -<span class="identifier">mpfr_float</span> <span class="identifier">a</span> <span class="special">=</span> <span class="number">2</span><span class="special">;</span> -<span class="identifier">mpfr_float</span><span class="special">::</span><span class="identifier">default_precision</span><span class="special">(</span><span class="number">1000</span><span class="special">);</span> -<span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="identifier">mpfr_float</span><span class="special">::</span><span class="identifier">default_precision</span><span class="special">()</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span> -<span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="identifier">sqrt</span><span class="special">(</span><span class="identifier">a</span><span class="special">)</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span> <span class="comment">// print root-2</span> + <span class="comment">// Operations at variable precision and no numeric_limits support:</span> + <span class="identifier">mpfr_float</span> <span class="identifier">a</span> <span class="special">=</span> <span class="number">2</span><span class="special">;</span> + <span class="identifier">mpfr_float</span><span class="special">::</span><span class="identifier">default_precision</span><span class="special">(</span><span class="number">1000</span><span class="special">);</span> + <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="identifier">mpfr_float</span><span class="special">::</span><span class="identifier">default_precision</span><span class="special">()</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span> + <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="identifier">sqrt</span><span class="special">(</span><span class="identifier">a</span><span class="special">)</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span> <span class="comment">// print root-2</span> -<span class="comment">// Operations at fixed precision and full numeric_limits support:</span> -<span class="identifier">mpfr_float_100</span> <span class="identifier">b</span> <span class="special">=</span> <span class="number">2</span><span class="special">;</span> -<span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">numeric_limits</span><span class="special"><</span><span class="identifier">mpfr_float_100</span><span class="special">>::</span><span class="identifier">digits</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span> -<span class="comment">// We can use any C++ std lib function:</span> -<span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="identifier">log</span><span class="special">(</span><span class="identifier">b</span><span class="special">)</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span> <span class="comment">// print log(2)</span> -<span class="comment">// We can also use any function from Boost.Math:</span> -<span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">math</span><span class="special">::</span><span class="identifier">tgamma</span><span class="special">(</span><span class="identifier">b</span><span class="special">)</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span> -<span class="comment">// These even work when the argument is an expression template:</span> -<span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">math</span><span class="special">::</span><span class="identifier">tgamma</span><span class="special">(</span><span class="identifier">b</span> <span class="special">*</span> <span class="identifier">b</span><span class="special">)</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span> + <span class="comment">// Operations at fixed precision and full numeric_limits support:</span> + <span class="identifier">mpfr_float_100</span> <span class="identifier">b</span> <span class="special">=</span> <span class="number">2</span><span class="special">;</span> + <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">numeric_limits</span><span class="special"><</span><span class="identifier">mpfr_float_100</span><span class="special">>::</span><span class="identifier">digits</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span> + <span class="comment">// We can use any C++ std lib function:</span> + <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="identifier">log</span><span class="special">(</span><span class="identifier">b</span><span class="special">)</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span> <span class="comment">// print log(2)</span> + <span class="comment">// We can also use any function from Boost.Math:</span> + <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">math</span><span class="special">::</span><span class="identifier">tgamma</span><span class="special">(</span><span class="identifier">b</span><span class="special">)</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span> + <span class="comment">// These even work when the argument is an expression template:</span> + <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">math</span><span class="special">::</span><span class="identifier">tgamma</span><span class="special">(</span><span class="identifier">b</span> <span class="special">*</span> <span class="identifier">b</span><span class="special">)</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span> -<span class="comment">// Access the underlying data:</span> -<span class="identifier">mpfr_t</span> <span class="identifier">r</span><span class="special">;</span> -<span class="identifier">mpfr_init</span><span class="special">(</span><span class="identifier">r</span><span class="special">);</span> -<span class="identifier">mpfr_set</span><span class="special">(</span><span class="identifier">r</span><span class="special">,</span> <span class="identifier">b</span><span class="special">.</span><span class="identifier">backend</span><span class="special">().</span><span class="identifier">data</span><span class="special">(),</span> <span class="identifier">GMP_RNDN</span><span class="special">);</span> + <span class="comment">// Access the underlying data:</span> + <span class="identifier">mpfr_t</span> <span class="identifier">r</span><span class="special">;</span> + <span class="identifier">mpfr_init</span><span class="special">(</span><span class="identifier">r</span><span class="special">);</span> + <span class="identifier">mpfr_set</span><span class="special">(</span><span class="identifier">r</span><span class="special">,</span> <span class="identifier">b</span><span class="special">.</span><span class="identifier">backend</span><span class="special">().</span><span class="identifier">data</span><span class="special">(),</span> <span class="identifier">GMP_RNDN</span><span class="special">);</span> + <span class="identifier">mpfr_clear</span><span class="special">(</span><span class="identifier">r</span><span class="special">);</span> + <span class="keyword">return</span> <span class="number">0</span><span class="special">;</span> +<span class="special">}</span> </pre> <div class="footnotes"> <br><hr style="width:100; text-align:left;margin-left: 0"> diff --git a/libs/multiprecision/doc/html/boost_multiprecision/tut/interval/mpfi.html b/libs/multiprecision/doc/html/boost_multiprecision/tut/interval/mpfi.html index 64a05e977..fcd2aea9d 100644 --- a/libs/multiprecision/doc/html/boost_multiprecision/tut/interval/mpfi.html +++ b/libs/multiprecision/doc/html/boost_multiprecision/tut/interval/mpfi.html @@ -235,32 +235,39 @@ example:</a> </h6> <pre class="programlisting"><span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">multiprecision</span><span class="special">/</span><span class="identifier">mpfi</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span> +<span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">math</span><span class="special">/</span><span class="identifier">special_functions</span><span class="special">/</span><span class="identifier">gamma</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span> +<span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">iostream</span><span class="special">></span> -<span class="keyword">using</span> <span class="keyword">namespace</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">multiprecision</span><span class="special">;</span> +<span class="keyword">int</span> <span class="identifier">main</span><span class="special">()</span> +<span class="special">{</span> + <span class="keyword">using</span> <span class="keyword">namespace</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">multiprecision</span><span class="special">;</span> -<span class="comment">// Operations at variable precision and no numeric_limits support:</span> -<span class="identifier">mpfi_float</span> <span class="identifier">a</span> <span class="special">=</span> <span class="number">2</span><span class="special">;</span> -<span class="identifier">mpfi_float</span><span class="special">::</span><span class="identifier">default_precision</span><span class="special">(</span><span class="number">1000</span><span class="special">);</span> -<span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="identifier">mpfi_float</span><span class="special">::</span><span class="identifier">default_precision</span><span class="special">()</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span> -<span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="identifier">sqrt</span><span class="special">(</span><span class="identifier">a</span><span class="special">)</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span> <span class="comment">// print root-2</span> + <span class="comment">// Operations at variable precision and no numeric_limits support:</span> + <span class="identifier">mpfi_float</span> <span class="identifier">a</span> <span class="special">=</span> <span class="number">2</span><span class="special">;</span> + <span class="identifier">mpfi_float</span><span class="special">::</span><span class="identifier">default_precision</span><span class="special">(</span><span class="number">1000</span><span class="special">);</span> + <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="identifier">mpfi_float</span><span class="special">::</span><span class="identifier">default_precision</span><span class="special">()</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span> + <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="identifier">sqrt</span><span class="special">(</span><span class="identifier">a</span><span class="special">)</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span> <span class="comment">// print root-2</span> -<span class="comment">// Operations at fixed precision and full numeric_limits support:</span> -<span class="identifier">mpfi_float_100</span> <span class="identifier">b</span> <span class="special">=</span> <span class="number">2</span><span class="special">;</span> -<span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">numeric_limits</span><span class="special"><</span><span class="identifier">mpfi_float_100</span><span class="special">>::</span><span class="identifier">digits</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span> -<span class="comment">// We can use any C++ std lib function:</span> -<span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="identifier">log</span><span class="special">(</span><span class="identifier">b</span><span class="special">)</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span> <span class="comment">// print log(2)</span> + <span class="comment">// Operations at fixed precision and full numeric_limits support:</span> + <span class="identifier">mpfi_float_100</span> <span class="identifier">b</span> <span class="special">=</span> <span class="number">2</span><span class="special">;</span> + <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">numeric_limits</span><span class="special"><</span><span class="identifier">mpfi_float_100</span><span class="special">>::</span><span class="identifier">digits</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span> + <span class="comment">// We can use any C++ std lib function:</span> + <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="identifier">log</span><span class="special">(</span><span class="identifier">b</span><span class="special">)</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span> <span class="comment">// print log(2)</span> -<span class="comment">// Access the underlying data:</span> -<span class="identifier">mpfi_t</span> <span class="identifier">r</span><span class="special">;</span> -<span class="identifier">mpfi_init</span><span class="special">(</span><span class="identifier">r</span><span class="special">);</span> -<span class="identifier">mpfi_set</span><span class="special">(</span><span class="identifier">r</span><span class="special">,</span> <span class="identifier">b</span><span class="special">.</span><span class="identifier">backend</span><span class="special">().</span><span class="identifier">data</span><span class="special">());</span> + <span class="comment">// Access the underlying data:</span> + <span class="identifier">mpfi_t</span> <span class="identifier">r</span><span class="special">;</span> + <span class="identifier">mpfi_init</span><span class="special">(</span><span class="identifier">r</span><span class="special">);</span> + <span class="identifier">mpfi_set</span><span class="special">(</span><span class="identifier">r</span><span class="special">,</span> <span class="identifier">b</span><span class="special">.</span><span class="identifier">backend</span><span class="special">().</span><span class="identifier">data</span><span class="special">());</span> -<span class="comment">// Construct some explicit intervals and perform set operations:</span> -<span class="identifier">mpfi_float_50</span> <span class="identifier">i1</span><span class="special">(</span><span class="number">1</span><span class="special">,</span> <span class="number">2</span><span class="special">),</span> <span class="identifier">i2</span><span class="special">(</span><span class="number">1.5</span><span class="special">,</span> <span class="number">2.5</span><span class="special">);</span> -<span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="identifier">intersect</span><span class="special">(</span><span class="identifier">i1</span><span class="special">,</span> <span class="identifier">i2</span><span class="special">)</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span> -<span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="identifier">hull</span><span class="special">(</span><span class="identifier">i1</span><span class="special">,</span> <span class="identifier">i2</span><span class="special">)</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span> -<span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="identifier">overlap</span><span class="special">(</span><span class="identifier">i1</span><span class="special">,</span> <span class="identifier">i2</span><span class="special">)</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span> -<span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="identifier">subset</span><span class="special">(</span><span class="identifier">i1</span><span class="special">,</span> <span class="identifier">i2</span><span class="special">)</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span> + <span class="comment">// Construct some explicit intervals and perform set operations:</span> + <span class="identifier">mpfi_float_50</span> <span class="identifier">i1</span><span class="special">(</span><span class="number">1</span><span class="special">,</span> <span class="number">2</span><span class="special">),</span> <span class="identifier">i2</span><span class="special">(</span><span class="number">1.5</span><span class="special">,</span> <span class="number">2.5</span><span class="special">);</span> + <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="identifier">intersect</span><span class="special">(</span><span class="identifier">i1</span><span class="special">,</span> <span class="identifier">i2</span><span class="special">)</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span> + <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="identifier">hull</span><span class="special">(</span><span class="identifier">i1</span><span class="special">,</span> <span class="identifier">i2</span><span class="special">)</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span> + <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="identifier">overlap</span><span class="special">(</span><span class="identifier">i1</span><span class="special">,</span> <span class="identifier">i2</span><span class="special">)</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span> + <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="identifier">subset</span><span class="special">(</span><span class="identifier">i1</span><span class="special">,</span> <span class="identifier">i2</span><span class="special">)</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span> + <span class="identifier">mpfi_clear</span><span class="special">(</span><span class="identifier">r</span><span class="special">);</span> + <span class="keyword">return</span> <span class="number">0</span><span class="special">;</span> +<span class="special">}</span> </pre> </div> <table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr> diff --git a/libs/multiprecision/doc/html/boost_multiprecision/tut/ints/cpp_int.html b/libs/multiprecision/doc/html/boost_multiprecision/tut/ints/cpp_int.html index 8001bdfca..ab836530f 100644 --- a/libs/multiprecision/doc/html/boost_multiprecision/tut/ints/cpp_int.html +++ b/libs/multiprecision/doc/html/boost_multiprecision/tut/ints/cpp_int.html @@ -36,8 +36,8 @@ <span class="keyword">enum</span> <span class="identifier">cpp_integer_type</span> <span class="special">{</span> <span class="identifier">signed_magnitude</span><span class="special">,</span> <span class="identifier">unsigned_magnitude</span> <span class="special">};</span> <span class="keyword">enum</span> <span class="identifier">cpp_int_check_type</span> <span class="special">{</span> <span class="identifier">checked</span><span class="special">,</span> <span class="identifier">unchecked</span> <span class="special">};</span> -<span class="keyword">template</span> <span class="special"><</span><span class="keyword">unsigned</span> <span class="identifier">MinDigits</span> <span class="special">=</span> <span class="number">0</span><span class="special">,</span> - <span class="keyword">unsigned</span> <span class="identifier">MaxDits</span> <span class="special">=</span> <span class="number">0</span><span class="special">,</span> +<span class="keyword">template</span> <span class="special"><</span><span class="keyword">unsigned</span> <span class="identifier">MinBits</span> <span class="special">=</span> <span class="number">0</span><span class="special">,</span> + <span class="keyword">unsigned</span> <span class="identifier">MaxBits</span> <span class="special">=</span> <span class="number">0</span><span class="special">,</span> <span class="identifier">cpp_integer_type</span> <span class="identifier">SignType</span> <span class="special">=</span> <span class="identifier">signed_magnitude</span><span class="special">,</span> <span class="identifier">cpp_int_check_type</span> <span class="identifier">Checked</span> <span class="special">=</span> <span class="identifier">unchecked</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Allocator</span> <span class="special">=</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">allocator</span><span class="special"><</span><span class="identifier">limb_type</span><span class="special">></span> <span class="special">></span> @@ -45,8 +45,8 @@ <span class="comment">//</span> <span class="comment">// Expression templates default to et_off if there is no allocator:</span> <span class="comment">//</span> -<span class="keyword">template</span> <span class="special"><</span><span class="keyword">unsigned</span> <span class="identifier">MinDigits</span><span class="special">,</span> <span class="keyword">unsigned</span> <span class="identifier">MaxDigits</span><span class="special">,</span> <span class="identifier">cpp_integer_type</span> <span class="identifier">SignType</span><span class="special">,</span> <span class="identifier">cpp_int_check_type</span> <span class="identifier">Checked</span><span class="special">></span> -<span class="keyword">struct</span> <span class="identifier">expression_template_default</span><span class="special"><</span><span class="identifier">cpp_int_backend</span><span class="special"><</span><span class="identifier">MinDigits</span><span class="special">,</span> <span class="identifier">MaxDigits</span><span class="special">,</span> <span class="identifier">SignType</span><span class="special">,</span> <span class="identifier">Checked</span><span class="special">,</span> <span class="keyword">void</span><span class="special">></span> <span class="special">></span> +<span class="keyword">template</span> <span class="special"><</span><span class="keyword">unsigned</span> <span class="identifier">MinBits</span><span class="special">,</span> <span class="keyword">unsigned</span> <span class="identifier">MaxBits</span><span class="special">,</span> <span class="identifier">cpp_integer_type</span> <span class="identifier">SignType</span><span class="special">,</span> <span class="identifier">cpp_int_check_type</span> <span class="identifier">Checked</span><span class="special">></span> +<span class="keyword">struct</span> <span class="identifier">expression_template_default</span><span class="special"><</span><span class="identifier">cpp_int_backend</span><span class="special"><</span><span class="identifier">MinBits</span><span class="special">,</span> <span class="identifier">MaxBits</span><span class="special">,</span> <span class="identifier">SignType</span><span class="special">,</span> <span class="identifier">Checked</span><span class="special">,</span> <span class="keyword">void</span><span class="special">></span> <span class="special">></span> <span class="special">{</span> <span class="keyword">static</span> <span class="keyword">const</span> <span class="identifier">expression_template_option</span> <span class="identifier">value</span> <span class="special">=</span> <span class="identifier">et_off</span><span class="special">;</span> <span class="special">};</span> <span class="keyword">typedef</span> <span class="identifier">number</span><span class="special"><</span><span class="identifier">cpp_int_backend</span><span class="special"><></span> <span class="special">></span> <span class="identifier">cpp_int</span><span class="special">;</span> <span class="comment">// arbitrary precision integer</span> @@ -344,23 +344,29 @@ <span class="phrase"><a name="boost_multiprecision.tut.ints.cpp_int.example"></a></span><a class="link" href="cpp_int.html#boost_multiprecision.tut.ints.cpp_int.example">Example:</a> </h6> <pre class="programlisting"><span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">multiprecision</span><span class="special">/</span><span class="identifier">cpp_int</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span> +<span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">iostream</span><span class="special">></span> -<span class="keyword">using</span> <span class="keyword">namespace</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">multiprecision</span><span class="special">;</span> +<span class="keyword">int</span> <span class="identifier">main</span><span class="special">()</span> +<span class="special">{</span> + <span class="keyword">using</span> <span class="keyword">namespace</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">multiprecision</span><span class="special">;</span> -<span class="identifier">int128_t</span> <span class="identifier">v</span> <span class="special">=</span> <span class="number">1</span><span class="special">;</span> + <span class="identifier">int128_t</span> <span class="identifier">v</span> <span class="special">=</span> <span class="number">1</span><span class="special">;</span> -<span class="comment">// Do some fixed precision arithmetic:</span> -<span class="keyword">for</span><span class="special">(</span><span class="keyword">unsigned</span> <span class="identifier">i</span> <span class="special">=</span> <span class="number">1</span><span class="special">;</span> <span class="identifier">i</span> <span class="special"><=</span> <span class="number">20</span><span class="special">;</span> <span class="special">++</span><span class="identifier">i</span><span class="special">)</span> - <span class="identifier">v</span> <span class="special">*=</span> <span class="identifier">i</span><span class="special">;</span> + <span class="comment">// Do some fixed precision arithmetic:</span> + <span class="keyword">for</span><span class="special">(</span><span class="keyword">unsigned</span> <span class="identifier">i</span> <span class="special">=</span> <span class="number">1</span><span class="special">;</span> <span class="identifier">i</span> <span class="special"><=</span> <span class="number">20</span><span class="special">;</span> <span class="special">++</span><span class="identifier">i</span><span class="special">)</span> + <span class="identifier">v</span> <span class="special">*=</span> <span class="identifier">i</span><span class="special">;</span> -<span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="identifier">v</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span> <span class="comment">// prints 20!</span> + <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="identifier">v</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span> <span class="comment">// prints 20!</span> -<span class="comment">// Repeat at arbitrary precision:</span> -<span class="identifier">cpp_int</span> <span class="identifier">u</span> <span class="special">=</span> <span class="number">1</span><span class="special">;</span> -<span class="keyword">for</span><span class="special">(</span><span class="keyword">unsigned</span> <span class="identifier">i</span> <span class="special">=</span> <span class="number">1</span><span class="special">;</span> <span class="identifier">i</span> <span class="special"><=</span> <span class="number">100</span><span class="special">;</span> <span class="special">++</span><span class="identifier">i</span><span class="special">)</span> - <span class="identifier">u</span> <span class="special">*=</span> <span class="identifier">i</span><span class="special">;</span> + <span class="comment">// Repeat at arbitrary precision:</span> + <span class="identifier">cpp_int</span> <span class="identifier">u</span> <span class="special">=</span> <span class="number">1</span><span class="special">;</span> + <span class="keyword">for</span><span class="special">(</span><span class="keyword">unsigned</span> <span class="identifier">i</span> <span class="special">=</span> <span class="number">1</span><span class="special">;</span> <span class="identifier">i</span> <span class="special"><=</span> <span class="number">100</span><span class="special">;</span> <span class="special">++</span><span class="identifier">i</span><span class="special">)</span> + <span class="identifier">u</span> <span class="special">*=</span> <span class="identifier">i</span><span class="special">;</span> -<span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="identifier">u</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span> <span class="comment">// prints 100!</span> + <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="identifier">u</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span> <span class="comment">// prints 100!</span> + + <span class="keyword">return</span> <span class="number">0</span><span class="special">;</span> +<span class="special">}</span> </pre> </div> <table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr> diff --git a/libs/multiprecision/doc/html/boost_multiprecision/tut/ints/gmp_int.html b/libs/multiprecision/doc/html/boost_multiprecision/tut/ints/gmp_int.html index 4dbceeb66..e27cdf7c5 100644 --- a/libs/multiprecision/doc/html/boost_multiprecision/tut/ints/gmp_int.html +++ b/libs/multiprecision/doc/html/boost_multiprecision/tut/ints/gmp_int.html @@ -109,21 +109,27 @@ <span class="phrase"><a name="boost_multiprecision.tut.ints.gmp_int.example"></a></span><a class="link" href="gmp_int.html#boost_multiprecision.tut.ints.gmp_int.example">Example:</a> </h6> <pre class="programlisting"><span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">multiprecision</span><span class="special">/</span><span class="identifier">gmp</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span> +<span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">iostream</span><span class="special">></span> -<span class="keyword">using</span> <span class="keyword">namespace</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">multiprecision</span><span class="special">;</span> +<span class="keyword">int</span> <span class="identifier">main</span><span class="special">()</span> +<span class="special">{</span> + <span class="keyword">using</span> <span class="keyword">namespace</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">multiprecision</span><span class="special">;</span> -<span class="identifier">mpz_int</span> <span class="identifier">v</span> <span class="special">=</span> <span class="number">1</span><span class="special">;</span> + <span class="identifier">mpz_int</span> <span class="identifier">v</span> <span class="special">=</span> <span class="number">1</span><span class="special">;</span> -<span class="comment">// Do some arithmetic:</span> -<span class="keyword">for</span><span class="special">(</span><span class="keyword">unsigned</span> <span class="identifier">i</span> <span class="special">=</span> <span class="number">1</span><span class="special">;</span> <span class="identifier">i</span> <span class="special"><=</span> <span class="number">1000</span><span class="special">;</span> <span class="special">++</span><span class="identifier">i</span><span class="special">)</span> - <span class="identifier">v</span> <span class="special">*=</span> <span class="identifier">i</span><span class="special">;</span> + <span class="comment">// Do some arithmetic:</span> + <span class="keyword">for</span><span class="special">(</span><span class="keyword">unsigned</span> <span class="identifier">i</span> <span class="special">=</span> <span class="number">1</span><span class="special">;</span> <span class="identifier">i</span> <span class="special"><=</span> <span class="number">1000</span><span class="special">;</span> <span class="special">++</span><span class="identifier">i</span><span class="special">)</span> + <span class="identifier">v</span> <span class="special">*=</span> <span class="identifier">i</span><span class="special">;</span> -<span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="identifier">v</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span> <span class="comment">// prints 1000!</span> + <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="identifier">v</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span> <span class="comment">// prints 1000!</span> -<span class="comment">// Access the underlying representation:</span> -<span class="identifier">mpz_t</span> <span class="identifier">z</span><span class="special">;</span> -<span class="identifier">mpz_init</span><span class="special">(</span><span class="identifier">z</span><span class="special">);</span> -<span class="identifier">mpz_set</span><span class="special">(</span><span class="identifier">z</span><span class="special">,</span> <span class="identifier">v</span><span class="special">.</span><span class="identifier">backend</span><span class="special">().</span><span class="identifier">data</span><span class="special">());</span> + <span class="comment">// Access the underlying representation:</span> + <span class="identifier">mpz_t</span> <span class="identifier">z</span><span class="special">;</span> + <span class="identifier">mpz_init</span><span class="special">(</span><span class="identifier">z</span><span class="special">);</span> + <span class="identifier">mpz_set</span><span class="special">(</span><span class="identifier">z</span><span class="special">,</span> <span class="identifier">v</span><span class="special">.</span><span class="identifier">backend</span><span class="special">().</span><span class="identifier">data</span><span class="special">());</span> + <span class="identifier">mpz_clear</span><span class="special">(</span><span class="identifier">z</span><span class="special">);</span> + <span class="keyword">return</span> <span class="number">0</span><span class="special">;</span> +<span class="special">}</span> </pre> </div> <table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr> diff --git a/libs/multiprecision/doc/html/boost_multiprecision/tut/ints/tom_int.html b/libs/multiprecision/doc/html/boost_multiprecision/tut/ints/tom_int.html index a5a5e1224..265acbde5 100644 --- a/libs/multiprecision/doc/html/boost_multiprecision/tut/ints/tom_int.html +++ b/libs/multiprecision/doc/html/boost_multiprecision/tut/ints/tom_int.html @@ -83,32 +83,38 @@ <span class="phrase"><a name="boost_multiprecision.tut.ints.tom_int.example"></a></span><a class="link" href="tom_int.html#boost_multiprecision.tut.ints.tom_int.example">Example:</a> </h6> <pre class="programlisting"><span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">multiprecision</span><span class="special">/</span><span class="identifier">tommath</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span> +<span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">iostream</span><span class="special">></span> -<span class="identifier">boost</span><span class="special">::</span><span class="identifier">multiprecision</span><span class="special">::</span><span class="identifier">tom_int</span> <span class="identifier">v</span> <span class="special">=</span> <span class="number">1</span><span class="special">;</span> +<span class="keyword">int</span> <span class="identifier">main</span><span class="special">()</span> +<span class="special">{</span> + <span class="identifier">boost</span><span class="special">::</span><span class="identifier">multiprecision</span><span class="special">::</span><span class="identifier">tom_int</span> <span class="identifier">v</span> <span class="special">=</span> <span class="number">1</span><span class="special">;</span> -<span class="comment">// Do some arithmetic:</span> -<span class="keyword">for</span><span class="special">(</span><span class="keyword">unsigned</span> <span class="identifier">i</span> <span class="special">=</span> <span class="number">1</span><span class="special">;</span> <span class="identifier">i</span> <span class="special"><=</span> <span class="number">1000</span><span class="special">;</span> <span class="special">++</span><span class="identifier">i</span><span class="special">)</span> - <span class="identifier">v</span> <span class="special">*=</span> <span class="identifier">i</span><span class="special">;</span> + <span class="comment">// Do some arithmetic:</span> + <span class="keyword">for</span><span class="special">(</span><span class="keyword">unsigned</span> <span class="identifier">i</span> <span class="special">=</span> <span class="number">1</span><span class="special">;</span> <span class="identifier">i</span> <span class="special"><=</span> <span class="number">1000</span><span class="special">;</span> <span class="special">++</span><span class="identifier">i</span><span class="special">)</span> + <span class="identifier">v</span> <span class="special">*=</span> <span class="identifier">i</span><span class="special">;</span> -<span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="identifier">v</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span> <span class="comment">// prints 1000!</span> -<span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">hex</span> <span class="special"><<</span> <span class="identifier">v</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span> <span class="comment">// prints 1000! in hex format</span> + <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="identifier">v</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span> <span class="comment">// prints 1000!</span> + <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">hex</span> <span class="special"><<</span> <span class="identifier">v</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span> <span class="comment">// prints 1000! in hex format</span> -<span class="keyword">try</span><span class="special">{</span> - <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">hex</span> <span class="special"><<</span> <span class="special">-</span><span class="identifier">v</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span> <span class="comment">// Ooops! can't print a negative value in hex format!</span> -<span class="special">}</span> -<span class="keyword">catch</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">runtime_error</span><span class="special">&</span> <span class="identifier">e</span><span class="special">)</span> -<span class="special">{</span> - <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="identifier">e</span><span class="special">.</span><span class="identifier">what</span><span class="special">()</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span> -<span class="special">}</span> + <span class="keyword">try</span><span class="special">{</span> + <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">hex</span> <span class="special"><<</span> <span class="special">-</span><span class="identifier">v</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span> <span class="comment">// Ooops! can't print a negative value in hex format!</span> + <span class="special">}</span> + <span class="keyword">catch</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">runtime_error</span><span class="special">&</span> <span class="identifier">e</span><span class="special">)</span> + <span class="special">{</span> + <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="identifier">e</span><span class="special">.</span><span class="identifier">what</span><span class="special">()</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span> + <span class="special">}</span> -<span class="keyword">try</span><span class="special">{</span> - <span class="comment">// v is not a 2's complement type, bitwise operations are only supported</span> - <span class="comment">// on positive values:</span> - <span class="identifier">v</span> <span class="special">=</span> <span class="special">-</span><span class="identifier">v</span> <span class="special">&</span> <span class="number">2</span><span class="special">;</span> -<span class="special">}</span> -<span class="keyword">catch</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">runtime_error</span><span class="special">&</span> <span class="identifier">e</span><span class="special">)</span> -<span class="special">{</span> - <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="identifier">e</span><span class="special">.</span><span class="identifier">what</span><span class="special">()</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span> + <span class="keyword">try</span><span class="special">{</span> + <span class="comment">// v is not a 2's complement type, bitwise operations are only supported</span> + <span class="comment">// on positive values:</span> + <span class="identifier">v</span> <span class="special">=</span> <span class="special">-</span><span class="identifier">v</span> <span class="special">&</span> <span class="number">2</span><span class="special">;</span> + <span class="special">}</span> + <span class="keyword">catch</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">runtime_error</span><span class="special">&</span> <span class="identifier">e</span><span class="special">)</span> + <span class="special">{</span> + <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="identifier">e</span><span class="special">.</span><span class="identifier">what</span><span class="special">()</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span> + <span class="special">}</span> + + <span class="keyword">return</span> <span class="number">0</span><span class="special">;</span> <span class="special">}</span> </pre> </div> diff --git a/libs/multiprecision/doc/html/boost_multiprecision/tut/mixed.html b/libs/multiprecision/doc/html/boost_multiprecision/tut/mixed.html index 343f2c2d5..4eb40a8c7 100644 --- a/libs/multiprecision/doc/html/boost_multiprecision/tut/mixed.html +++ b/libs/multiprecision/doc/html/boost_multiprecision/tut/mixed.html @@ -111,24 +111,29 @@ </p> <pre class="programlisting"><span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">multiprecision</span><span class="special">/</span><span class="identifier">cpp_int</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span> -<span class="keyword">using</span> <span class="keyword">namespace</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">multiprecision</span><span class="special">;</span> +<span class="keyword">int</span> <span class="identifier">main</span><span class="special">()</span> +<span class="special">{</span> + <span class="keyword">using</span> <span class="keyword">namespace</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">multiprecision</span><span class="special">;</span> -<span class="identifier">boost</span><span class="special">::</span><span class="identifier">uint64_t</span> <span class="identifier">i</span> <span class="special">=</span> <span class="special">(</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">numeric_limits</span><span class="special"><</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">uint64_t</span><span class="special">>::</span><span class="identifier">max</span><span class="special">)();</span> -<span class="identifier">boost</span><span class="special">::</span><span class="identifier">uint64_t</span> <span class="identifier">j</span> <span class="special">=</span> <span class="number">1</span><span class="special">;</span> + <span class="identifier">boost</span><span class="special">::</span><span class="identifier">uint64_t</span> <span class="identifier">i</span> <span class="special">=</span> <span class="special">(</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">numeric_limits</span><span class="special"><</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">uint64_t</span><span class="special">>::</span><span class="identifier">max</span><span class="special">)();</span> + <span class="identifier">boost</span><span class="special">::</span><span class="identifier">uint64_t</span> <span class="identifier">j</span> <span class="special">=</span> <span class="number">1</span><span class="special">;</span> -<span class="identifier">uint128_t</span> <span class="identifier">ui128</span><span class="special">;</span> -<span class="identifier">uint256_t</span> <span class="identifier">ui256</span><span class="special">;</span> -<span class="comment">//</span> -<span class="comment">// Start by performing arithmetic on 64-bit integers to yield 128-bit results:</span> -<span class="comment">//</span> -<span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">hex</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">showbase</span> <span class="special"><<</span> <span class="identifier">i</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span> -<span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">hex</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">showbase</span> <span class="special"><<</span> <span class="identifier">add</span><span class="special">(</span><span class="identifier">ui128</span><span class="special">,</span> <span class="identifier">i</span><span class="special">,</span> <span class="identifier">j</span><span class="special">)</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span> -<span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">hex</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">showbase</span> <span class="special"><<</span> <span class="identifier">multiply</span><span class="special">(</span><span class="identifier">ui128</span><span class="special">,</span> <span class="identifier">i</span><span class="special">,</span> <span class="identifier">i</span><span class="special">)</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span> -<span class="comment">//</span> -<span class="comment">// The try squaring a 128-bit integer to yield a 256-bit result:</span> -<span class="comment">//</span> -<span class="identifier">ui128</span> <span class="special">=</span> <span class="special">(</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">numeric_limits</span><span class="special"><</span><span class="identifier">uint128_t</span><span class="special">>::</span><span class="identifier">max</span><span class="special">)();</span> -<span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">hex</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">showbase</span> <span class="special"><<</span> <span class="identifier">multiply</span><span class="special">(</span><span class="identifier">ui256</span><span class="special">,</span> <span class="identifier">ui128</span><span class="special">,</span> <span class="identifier">ui128</span><span class="special">)</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span> + <span class="identifier">uint128_t</span> <span class="identifier">ui128</span><span class="special">;</span> + <span class="identifier">uint256_t</span> <span class="identifier">ui256</span><span class="special">;</span> + <span class="comment">//</span> + <span class="comment">// Start by performing arithmetic on 64-bit integers to yield 128-bit results:</span> + <span class="comment">//</span> + <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">hex</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">showbase</span> <span class="special"><<</span> <span class="identifier">i</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span> + <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">hex</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">showbase</span> <span class="special"><<</span> <span class="identifier">add</span><span class="special">(</span><span class="identifier">ui128</span><span class="special">,</span> <span class="identifier">i</span><span class="special">,</span> <span class="identifier">j</span><span class="special">)</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span> + <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">hex</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">showbase</span> <span class="special"><<</span> <span class="identifier">multiply</span><span class="special">(</span><span class="identifier">ui128</span><span class="special">,</span> <span class="identifier">i</span><span class="special">,</span> <span class="identifier">i</span><span class="special">)</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span> + <span class="comment">//</span> + <span class="comment">// The try squaring a 128-bit integer to yield a 256-bit result:</span> + <span class="comment">//</span> + <span class="identifier">ui128</span> <span class="special">=</span> <span class="special">(</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">numeric_limits</span><span class="special"><</span><span class="identifier">uint128_t</span><span class="special">>::</span><span class="identifier">max</span><span class="special">)();</span> + <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">hex</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">showbase</span> <span class="special"><<</span> <span class="identifier">multiply</span><span class="special">(</span><span class="identifier">ui256</span><span class="special">,</span> <span class="identifier">ui128</span><span class="special">,</span> <span class="identifier">ui128</span><span class="special">)</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span> + + <span class="keyword">return</span> <span class="number">0</span><span class="special">;</span> +<span class="special">}</span> </pre> <p> Produces the output: diff --git a/libs/multiprecision/doc/html/boost_multiprecision/tut/random.html b/libs/multiprecision/doc/html/boost_multiprecision/tut/random.html index 98aa087eb..fa113f966 100644 --- a/libs/multiprecision/doc/html/boost_multiprecision/tut/random.html +++ b/libs/multiprecision/doc/html/boost_multiprecision/tut/random.html @@ -42,21 +42,25 @@ <pre class="programlisting"><span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">multiprecision</span><span class="special">/</span><span class="identifier">gmp</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span> <span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">multiprecision</span><span class="special">/</span><span class="identifier">random</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span> -<span class="keyword">using</span> <span class="keyword">namespace</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">multiprecision</span><span class="special">;</span> -<span class="keyword">using</span> <span class="keyword">namespace</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">random</span><span class="special">;</span> +<span class="keyword">int</span> <span class="identifier">main</span><span class="special">()</span> +<span class="special">{</span> + <span class="keyword">using</span> <span class="keyword">namespace</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">multiprecision</span><span class="special">;</span> + <span class="keyword">using</span> <span class="keyword">namespace</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">random</span><span class="special">;</span> -<span class="comment">//</span> -<span class="comment">// Declare our random number generator type, the underlying generator</span> -<span class="comment">// is the Mersenne twister mt19937 engine, and 256 bits are generated:</span> -<span class="comment">//</span> -<span class="keyword">typedef</span> <span class="identifier">independent_bits_engine</span><span class="special"><</span><span class="identifier">mt19937</span><span class="special">,</span> <span class="number">256</span><span class="special">,</span> <span class="identifier">mpz_int</span><span class="special">></span> <span class="identifier">generator_type</span><span class="special">;</span> -<span class="identifier">generator_type</span> <span class="identifier">gen</span><span class="special">;</span> -<span class="comment">//</span> -<span class="comment">// Generate some values:</span> -<span class="comment">//</span> -<span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">hex</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">showbase</span><span class="special">;</span> -<span class="keyword">for</span><span class="special">(</span><span class="keyword">unsigned</span> <span class="identifier">i</span> <span class="special">=</span> <span class="number">0</span><span class="special">;</span> <span class="identifier">i</span> <span class="special"><</span> <span class="number">10</span><span class="special">;</span> <span class="special">++</span><span class="identifier">i</span><span class="special">)</span> - <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="identifier">gen</span><span class="special">()</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span> + <span class="comment">//</span> + <span class="comment">// Declare our random number generator type, the underlying generator</span> + <span class="comment">// is the Mersenne twister mt19937 engine, and 256 bits are generated:</span> + <span class="comment">//</span> + <span class="keyword">typedef</span> <span class="identifier">independent_bits_engine</span><span class="special"><</span><span class="identifier">mt19937</span><span class="special">,</span> <span class="number">256</span><span class="special">,</span> <span class="identifier">mpz_int</span><span class="special">></span> <span class="identifier">generator_type</span><span class="special">;</span> + <span class="identifier">generator_type</span> <span class="identifier">gen</span><span class="special">;</span> + <span class="comment">//</span> + <span class="comment">// Generate some values:</span> + <span class="comment">//</span> + <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">hex</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">showbase</span><span class="special">;</span> + <span class="keyword">for</span><span class="special">(</span><span class="keyword">unsigned</span> <span class="identifier">i</span> <span class="special">=</span> <span class="number">0</span><span class="special">;</span> <span class="identifier">i</span> <span class="special"><</span> <span class="number">10</span><span class="special">;</span> <span class="special">++</span><span class="identifier">i</span><span class="special">)</span> + <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="identifier">gen</span><span class="special">()</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span> + <span class="keyword">return</span> <span class="number">0</span><span class="special">;</span> +<span class="special">}</span> </pre> <p> Alternatively we can generate integers in a given range using <code class="computeroutput"><span class="identifier">uniform_int_distribution</span></code>, this will invoke @@ -66,22 +70,27 @@ <pre class="programlisting"><span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">multiprecision</span><span class="special">/</span><span class="identifier">gmp</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span> <span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">multiprecision</span><span class="special">/</span><span class="identifier">random</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span> -<span class="keyword">using</span> <span class="keyword">namespace</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">multiprecision</span><span class="special">;</span> -<span class="keyword">using</span> <span class="keyword">namespace</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">random</span><span class="special">;</span> +<span class="keyword">int</span> <span class="identifier">main</span><span class="special">()</span> +<span class="special">{</span> + <span class="keyword">using</span> <span class="keyword">namespace</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">multiprecision</span><span class="special">;</span> + <span class="keyword">using</span> <span class="keyword">namespace</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">random</span><span class="special">;</span> -<span class="comment">//</span> -<span class="comment">// Generate integers in a given range using uniform_int,</span> -<span class="comment">// the underlying generator is invoked multiple times</span> -<span class="comment">// to generate enough bits:</span> -<span class="comment">//</span> -<span class="identifier">mt19937</span> <span class="identifier">mt</span><span class="special">;</span> -<span class="identifier">uniform_int_distribution</span><span class="special"><</span><span class="identifier">mpz_int</span><span class="special">></span> <span class="identifier">ui</span><span class="special">(</span><span class="number">0</span><span class="special">,</span> <span class="identifier">mpz_int</span><span class="special">(</span><span class="number">1</span><span class="special">)</span> <span class="special"><<</span> <span class="number">256</span><span class="special">);</span> -<span class="comment">//</span> -<span class="comment">// Generate the numbers:</span> -<span class="comment">//</span> -<span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">hex</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">showbase</span><span class="special">;</span> -<span class="keyword">for</span><span class="special">(</span><span class="keyword">unsigned</span> <span class="identifier">i</span> <span class="special">=</span> <span class="number">0</span><span class="special">;</span> <span class="identifier">i</span> <span class="special"><</span> <span class="number">10</span><span class="special">;</span> <span class="special">++</span><span class="identifier">i</span><span class="special">)</span> - <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="identifier">ui</span><span class="special">(</span><span class="identifier">mt</span><span class="special">)</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span> + <span class="comment">//</span> + <span class="comment">// Generate integers in a given range using uniform_int,</span> + <span class="comment">// the underlying generator is invoked multiple times</span> + <span class="comment">// to generate enough bits:</span> + <span class="comment">//</span> + <span class="identifier">mt19937</span> <span class="identifier">mt</span><span class="special">;</span> + <span class="identifier">uniform_int_distribution</span><span class="special"><</span><span class="identifier">mpz_int</span><span class="special">></span> <span class="identifier">ui</span><span class="special">(</span><span class="number">0</span><span class="special">,</span> <span class="identifier">mpz_int</span><span class="special">(</span><span class="number">1</span><span class="special">)</span> <span class="special"><<</span> <span class="number">256</span><span class="special">);</span> + <span class="comment">//</span> + <span class="comment">// Generate the numbers:</span> + <span class="comment">//</span> + <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">hex</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">showbase</span><span class="special">;</span> + <span class="keyword">for</span><span class="special">(</span><span class="keyword">unsigned</span> <span class="identifier">i</span> <span class="special">=</span> <span class="number">0</span><span class="special">;</span> <span class="identifier">i</span> <span class="special"><</span> <span class="number">10</span><span class="special">;</span> <span class="special">++</span><span class="identifier">i</span><span class="special">)</span> + <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="identifier">ui</span><span class="special">(</span><span class="identifier">mt</span><span class="special">)</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span> + + <span class="keyword">return</span> <span class="number">0</span><span class="special">;</span> +<span class="special">}</span> </pre> <p> Floating point values in [0,1) are generated using <code class="computeroutput"><span class="identifier">uniform_01</span></code>, @@ -93,21 +102,25 @@ <pre class="programlisting"><span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">multiprecision</span><span class="special">/</span><span class="identifier">gmp</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span> <span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">multiprecision</span><span class="special">/</span><span class="identifier">random</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span> -<span class="keyword">using</span> <span class="keyword">namespace</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">multiprecision</span><span class="special">;</span> -<span class="keyword">using</span> <span class="keyword">namespace</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">random</span><span class="special">;</span> -<span class="comment">//</span> -<span class="comment">// We need an underlying generator with at least as many bits as the</span> -<span class="comment">// floating point type to generate numbers in [0, 1) with all the bits</span> -<span class="comment">// in the floating point type randomly filled:</span> -<span class="comment">//</span> -<span class="identifier">uniform_01</span><span class="special"><</span><span class="identifier">mpf_float_50</span><span class="special">></span> <span class="identifier">uf</span><span class="special">;</span> -<span class="identifier">independent_bits_engine</span><span class="special"><</span><span class="identifier">mt19937</span><span class="special">,</span> <span class="number">50L</span><span class="special">*</span><span class="number">1000L</span><span class="special">/</span><span class="number">301L</span><span class="special">,</span> <span class="identifier">mpz_int</span><span class="special">></span> <span class="identifier">gen</span><span class="special">;</span> -<span class="comment">//</span> -<span class="comment">// Generate the values:</span> -<span class="comment">//</span> -<span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">setprecision</span><span class="special">(</span><span class="number">50</span><span class="special">);</span> -<span class="keyword">for</span><span class="special">(</span><span class="keyword">unsigned</span> <span class="identifier">i</span> <span class="special">=</span> <span class="number">0</span><span class="special">;</span> <span class="identifier">i</span> <span class="special"><</span> <span class="number">20</span><span class="special">;</span> <span class="special">++</span><span class="identifier">i</span><span class="special">)</span> - <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="identifier">uf</span><span class="special">(</span><span class="identifier">gen</span><span class="special">)</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span> +<span class="keyword">int</span> <span class="identifier">main</span><span class="special">()</span> +<span class="special">{</span> + <span class="keyword">using</span> <span class="keyword">namespace</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">multiprecision</span><span class="special">;</span> + <span class="keyword">using</span> <span class="keyword">namespace</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">random</span><span class="special">;</span> + <span class="comment">//</span> + <span class="comment">// We need an underlying generator with at least as many bits as the</span> + <span class="comment">// floating point type to generate numbers in [0, 1) with all the bits</span> + <span class="comment">// in the floating point type randomly filled:</span> + <span class="comment">//</span> + <span class="identifier">uniform_01</span><span class="special"><</span><span class="identifier">mpf_float_50</span><span class="special">></span> <span class="identifier">uf</span><span class="special">;</span> + <span class="identifier">independent_bits_engine</span><span class="special"><</span><span class="identifier">mt19937</span><span class="special">,</span> <span class="number">50L</span><span class="special">*</span><span class="number">1000L</span><span class="special">/</span><span class="number">301L</span><span class="special">,</span> <span class="identifier">mpz_int</span><span class="special">></span> <span class="identifier">gen</span><span class="special">;</span> + <span class="comment">//</span> + <span class="comment">// Generate the values:</span> + <span class="comment">//</span> + <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">setprecision</span><span class="special">(</span><span class="number">50</span><span class="special">);</span> + <span class="keyword">for</span><span class="special">(</span><span class="keyword">unsigned</span> <span class="identifier">i</span> <span class="special">=</span> <span class="number">0</span><span class="special">;</span> <span class="identifier">i</span> <span class="special"><</span> <span class="number">20</span><span class="special">;</span> <span class="special">++</span><span class="identifier">i</span><span class="special">)</span> + <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="identifier">uf</span><span class="special">(</span><span class="identifier">gen</span><span class="special">)</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span> + <span class="keyword">return</span> <span class="number">0</span><span class="special">;</span> +<span class="special">}</span> </pre> <p> Finally, we can modify the above example to produce numbers distributed according @@ -116,22 +129,26 @@ <pre class="programlisting"><span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">multiprecision</span><span class="special">/</span><span class="identifier">gmp</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span> <span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">multiprecision</span><span class="special">/</span><span class="identifier">random</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span> -<span class="keyword">using</span> <span class="keyword">namespace</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">multiprecision</span><span class="special">;</span> -<span class="keyword">using</span> <span class="keyword">namespace</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">random</span><span class="special">;</span> -<span class="comment">//</span> -<span class="comment">// We can repeat the above example, with other distributions:</span> -<span class="comment">//</span> -<span class="identifier">uniform_real_distribution</span><span class="special"><</span><span class="identifier">mpf_float_50</span><span class="special">></span> <span class="identifier">ur</span><span class="special">(-</span><span class="number">20</span><span class="special">,</span> <span class="number">20</span><span class="special">);</span> -<span class="identifier">gamma_distribution</span><span class="special"><</span><span class="identifier">mpf_float_50</span><span class="special">></span> <span class="identifier">gd</span><span class="special">(</span><span class="number">20</span><span class="special">);</span> -<span class="identifier">independent_bits_engine</span><span class="special"><</span><span class="identifier">mt19937</span><span class="special">,</span> <span class="number">50L</span><span class="special">*</span><span class="number">1000L</span><span class="special">/</span><span class="number">301L</span><span class="special">,</span> <span class="identifier">mpz_int</span><span class="special">></span> <span class="identifier">gen</span><span class="special">;</span> -<span class="comment">//</span> -<span class="comment">// Generate some values:</span> -<span class="comment">//</span> -<span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">setprecision</span><span class="special">(</span><span class="number">50</span><span class="special">);</span> -<span class="keyword">for</span><span class="special">(</span><span class="keyword">unsigned</span> <span class="identifier">i</span> <span class="special">=</span> <span class="number">0</span><span class="special">;</span> <span class="identifier">i</span> <span class="special"><</span> <span class="number">20</span><span class="special">;</span> <span class="special">++</span><span class="identifier">i</span><span class="special">)</span> - <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="identifier">ur</span><span class="special">(</span><span class="identifier">gen</span><span class="special">)</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span> -<span class="keyword">for</span><span class="special">(</span><span class="keyword">unsigned</span> <span class="identifier">i</span> <span class="special">=</span> <span class="number">0</span><span class="special">;</span> <span class="identifier">i</span> <span class="special"><</span> <span class="number">20</span><span class="special">;</span> <span class="special">++</span><span class="identifier">i</span><span class="special">)</span> - <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="identifier">gd</span><span class="special">(</span><span class="identifier">gen</span><span class="special">)</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span> +<span class="keyword">int</span> <span class="identifier">main</span><span class="special">()</span> +<span class="special">{</span> + <span class="keyword">using</span> <span class="keyword">namespace</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">multiprecision</span><span class="special">;</span> + <span class="keyword">using</span> <span class="keyword">namespace</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">random</span><span class="special">;</span> + <span class="comment">//</span> + <span class="comment">// We can repeat the above example, with other distributions:</span> + <span class="comment">//</span> + <span class="identifier">uniform_real_distribution</span><span class="special"><</span><span class="identifier">mpf_float_50</span><span class="special">></span> <span class="identifier">ur</span><span class="special">(-</span><span class="number">20</span><span class="special">,</span> <span class="number">20</span><span class="special">);</span> + <span class="identifier">gamma_distribution</span><span class="special"><</span><span class="identifier">mpf_float_50</span><span class="special">></span> <span class="identifier">gd</span><span class="special">(</span><span class="number">20</span><span class="special">);</span> + <span class="identifier">independent_bits_engine</span><span class="special"><</span><span class="identifier">mt19937</span><span class="special">,</span> <span class="number">50L</span><span class="special">*</span><span class="number">1000L</span><span class="special">/</span><span class="number">301L</span><span class="special">,</span> <span class="identifier">mpz_int</span><span class="special">></span> <span class="identifier">gen</span><span class="special">;</span> + <span class="comment">//</span> + <span class="comment">// Generate some values:</span> + <span class="comment">//</span> + <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">setprecision</span><span class="special">(</span><span class="number">50</span><span class="special">);</span> + <span class="keyword">for</span><span class="special">(</span><span class="keyword">unsigned</span> <span class="identifier">i</span> <span class="special">=</span> <span class="number">0</span><span class="special">;</span> <span class="identifier">i</span> <span class="special"><</span> <span class="number">20</span><span class="special">;</span> <span class="special">++</span><span class="identifier">i</span><span class="special">)</span> + <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="identifier">ur</span><span class="special">(</span><span class="identifier">gen</span><span class="special">)</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span> + <span class="keyword">for</span><span class="special">(</span><span class="keyword">unsigned</span> <span class="identifier">i</span> <span class="special">=</span> <span class="number">0</span><span class="special">;</span> <span class="identifier">i</span> <span class="special"><</span> <span class="number">20</span><span class="special">;</span> <span class="special">++</span><span class="identifier">i</span><span class="special">)</span> + <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="identifier">gd</span><span class="special">(</span><span class="identifier">gen</span><span class="special">)</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span> + <span class="keyword">return</span> <span class="number">0</span><span class="special">;</span> +<span class="special">}</span> </pre> </div> <table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr> diff --git a/libs/multiprecision/doc/html/boost_multiprecision/tut/rational/cpp_rational.html b/libs/multiprecision/doc/html/boost_multiprecision/tut/rational/cpp_rational.html index 4f1413eb8..6a5756867 100644 --- a/libs/multiprecision/doc/html/boost_multiprecision/tut/rational/cpp_rational.html +++ b/libs/multiprecision/doc/html/boost_multiprecision/tut/rational/cpp_rational.html @@ -84,22 +84,27 @@ <span class="phrase"><a name="boost_multiprecision.tut.rational.cpp_rational.example"></a></span><a class="link" href="cpp_rational.html#boost_multiprecision.tut.rational.cpp_rational.example">Example:</a> </h6> <pre class="programlisting"><span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">multiprecision</span><span class="special">/</span><span class="identifier">cpp_int</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span> +<span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">iostream</span><span class="special">></span> -<span class="keyword">using</span> <span class="keyword">namespace</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">multiprecision</span><span class="special">;</span> +<span class="keyword">int</span> <span class="identifier">main</span><span class="special">()</span> +<span class="special">{</span> + <span class="keyword">using</span> <span class="keyword">namespace</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">multiprecision</span><span class="special">;</span> -<span class="identifier">cpp_rational</span> <span class="identifier">v</span> <span class="special">=</span> <span class="number">1</span><span class="special">;</span> + <span class="identifier">cpp_rational</span> <span class="identifier">v</span> <span class="special">=</span> <span class="number">1</span><span class="special">;</span> -<span class="comment">// Do some arithmetic:</span> -<span class="keyword">for</span><span class="special">(</span><span class="keyword">unsigned</span> <span class="identifier">i</span> <span class="special">=</span> <span class="number">1</span><span class="special">;</span> <span class="identifier">i</span> <span class="special"><=</span> <span class="number">1000</span><span class="special">;</span> <span class="special">++</span><span class="identifier">i</span><span class="special">)</span> - <span class="identifier">v</span> <span class="special">*=</span> <span class="identifier">i</span><span class="special">;</span> -<span class="identifier">v</span> <span class="special">/=</span> <span class="number">10</span><span class="special">;</span> + <span class="comment">// Do some arithmetic:</span> + <span class="keyword">for</span><span class="special">(</span><span class="keyword">unsigned</span> <span class="identifier">i</span> <span class="special">=</span> <span class="number">1</span><span class="special">;</span> <span class="identifier">i</span> <span class="special"><=</span> <span class="number">1000</span><span class="special">;</span> <span class="special">++</span><span class="identifier">i</span><span class="special">)</span> + <span class="identifier">v</span> <span class="special">*=</span> <span class="identifier">i</span><span class="special">;</span> + <span class="identifier">v</span> <span class="special">/=</span> <span class="number">10</span><span class="special">;</span> -<span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="identifier">v</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span> <span class="comment">// prints 1000! / 10</span> -<span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="identifier">numerator</span><span class="special">(</span><span class="identifier">v</span><span class="special">)</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span> -<span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="identifier">denominator</span><span class="special">(</span><span class="identifier">v</span><span class="special">)</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span> + <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="identifier">v</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span> <span class="comment">// prints 1000! / 10</span> + <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="identifier">numerator</span><span class="special">(</span><span class="identifier">v</span><span class="special">)</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span> + <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="identifier">denominator</span><span class="special">(</span><span class="identifier">v</span><span class="special">)</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span> -<span class="identifier">cpp_rational</span> <span class="identifier">w</span><span class="special">(</span><span class="number">2</span><span class="special">,</span> <span class="number">3</span><span class="special">);</span> <span class="comment">// component wise constructor</span> -<span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="identifier">w</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span> <span class="comment">// prints 2/3</span> + <span class="identifier">cpp_rational</span> <span class="identifier">w</span><span class="special">(</span><span class="number">2</span><span class="special">,</span> <span class="number">3</span><span class="special">);</span> <span class="comment">// component wise constructor</span> + <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="identifier">w</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span> <span class="comment">// prints 2/3</span> + <span class="keyword">return</span> <span class="number">0</span><span class="special">;</span> +<span class="special">}</span> </pre> </div> <table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr> diff --git a/libs/multiprecision/doc/html/boost_multiprecision/tut/rational/gmp_rational.html b/libs/multiprecision/doc/html/boost_multiprecision/tut/rational/gmp_rational.html index fa6c2db2f..6800cc426 100644 --- a/libs/multiprecision/doc/html/boost_multiprecision/tut/rational/gmp_rational.html +++ b/libs/multiprecision/doc/html/boost_multiprecision/tut/rational/gmp_rational.html @@ -110,27 +110,34 @@ <span class="phrase"><a name="boost_multiprecision.tut.rational.gmp_rational.example"></a></span><a class="link" href="gmp_rational.html#boost_multiprecision.tut.rational.gmp_rational.example">Example:</a> </h6> <pre class="programlisting"><span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">multiprecision</span><span class="special">/</span><span class="identifier">gmp</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span> +<span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">multiprecision</span><span class="special">/</span><span class="identifier">gmp</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span> +<span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">iostream</span><span class="special">></span> -<span class="keyword">using</span> <span class="keyword">namespace</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">multiprecision</span><span class="special">;</span> +<span class="keyword">int</span> <span class="identifier">main</span><span class="special">()</span> +<span class="special">{</span> + <span class="keyword">using</span> <span class="keyword">namespace</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">multiprecision</span><span class="special">;</span> -<span class="identifier">mpq_rational</span> <span class="identifier">v</span> <span class="special">=</span> <span class="number">1</span><span class="special">;</span> + <span class="identifier">mpq_rational</span> <span class="identifier">v</span> <span class="special">=</span> <span class="number">1</span><span class="special">;</span> -<span class="comment">// Do some arithmetic:</span> -<span class="keyword">for</span><span class="special">(</span><span class="keyword">unsigned</span> <span class="identifier">i</span> <span class="special">=</span> <span class="number">1</span><span class="special">;</span> <span class="identifier">i</span> <span class="special"><=</span> <span class="number">1000</span><span class="special">;</span> <span class="special">++</span><span class="identifier">i</span><span class="special">)</span> - <span class="identifier">v</span> <span class="special">*=</span> <span class="identifier">i</span><span class="special">;</span> -<span class="identifier">v</span> <span class="special">/=</span> <span class="number">10</span><span class="special">;</span> + <span class="comment">// Do some arithmetic:</span> + <span class="keyword">for</span><span class="special">(</span><span class="keyword">unsigned</span> <span class="identifier">i</span> <span class="special">=</span> <span class="number">1</span><span class="special">;</span> <span class="identifier">i</span> <span class="special"><=</span> <span class="number">1000</span><span class="special">;</span> <span class="special">++</span><span class="identifier">i</span><span class="special">)</span> + <span class="identifier">v</span> <span class="special">*=</span> <span class="identifier">i</span><span class="special">;</span> + <span class="identifier">v</span> <span class="special">/=</span> <span class="number">10</span><span class="special">;</span> -<span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="identifier">v</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span> <span class="comment">// prints 1000! / 10</span> -<span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="identifier">numerator</span><span class="special">(</span><span class="identifier">v</span><span class="special">)</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span> -<span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="identifier">denominator</span><span class="special">(</span><span class="identifier">v</span><span class="special">)</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span> + <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="identifier">v</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span> <span class="comment">// prints 1000! / 10</span> + <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="identifier">numerator</span><span class="special">(</span><span class="identifier">v</span><span class="special">)</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span> + <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="identifier">denominator</span><span class="special">(</span><span class="identifier">v</span><span class="special">)</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span> -<span class="identifier">mpq_rational</span> <span class="identifier">w</span><span class="special">(</span><span class="number">2</span><span class="special">,</span> <span class="number">3</span><span class="special">);</span> <span class="comment">// component wise constructor</span> -<span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="identifier">w</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span> <span class="comment">// prints 2/3</span> + <span class="identifier">mpq_rational</span> <span class="identifier">w</span><span class="special">(</span><span class="number">2</span><span class="special">,</span> <span class="number">3</span><span class="special">);</span> <span class="comment">// component wise constructor</span> + <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="identifier">w</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span> <span class="comment">// prints 2/3</span> -<span class="comment">// Access the underlying data:</span> -<span class="identifier">mpq_t</span> <span class="identifier">q</span><span class="special">;</span> -<span class="identifier">mpq_init</span><span class="special">(</span><span class="identifier">q</span><span class="special">);</span> -<span class="identifier">mpq_set</span><span class="special">(</span><span class="identifier">q</span><span class="special">,</span> <span class="identifier">v</span><span class="special">.</span><span class="identifier">backend</span><span class="special">().</span><span class="identifier">data</span><span class="special">());</span> + <span class="comment">// Access the underlying data:</span> + <span class="identifier">mpq_t</span> <span class="identifier">q</span><span class="special">;</span> + <span class="identifier">mpq_init</span><span class="special">(</span><span class="identifier">q</span><span class="special">);</span> + <span class="identifier">mpq_set</span><span class="special">(</span><span class="identifier">q</span><span class="special">,</span> <span class="identifier">v</span><span class="special">.</span><span class="identifier">backend</span><span class="special">().</span><span class="identifier">data</span><span class="special">());</span> + <span class="identifier">mpq_clear</span><span class="special">(</span><span class="identifier">q</span><span class="special">);</span> + <span class="keyword">return</span> <span class="number">0</span><span class="special">;</span> +<span class="special">}</span> </pre> </div> <table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr> diff --git a/libs/multiprecision/doc/html/boost_multiprecision/tut/rational/tommath_rational.html b/libs/multiprecision/doc/html/boost_multiprecision/tut/rational/tommath_rational.html index 6cc3be72f..5df03879e 100644 --- a/libs/multiprecision/doc/html/boost_multiprecision/tut/rational/tommath_rational.html +++ b/libs/multiprecision/doc/html/boost_multiprecision/tut/rational/tommath_rational.html @@ -90,22 +90,28 @@ <span class="phrase"><a name="boost_multiprecision.tut.rational.tommath_rational.example"></a></span><a class="link" href="tommath_rational.html#boost_multiprecision.tut.rational.tommath_rational.example">Example:</a> </h6> <pre class="programlisting"><span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">multiprecision</span><span class="special">/</span><span class="identifier">tommath</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span> +<span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">iostream</span><span class="special">></span> -<span class="keyword">using</span> <span class="keyword">namespace</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">multiprecision</span><span class="special">;</span> +<span class="keyword">int</span> <span class="identifier">main</span><span class="special">()</span> +<span class="special">{</span> + <span class="keyword">using</span> <span class="keyword">namespace</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">multiprecision</span><span class="special">;</span> -<span class="identifier">tom_rational</span> <span class="identifier">v</span> <span class="special">=</span> <span class="number">1</span><span class="special">;</span> + <span class="identifier">tom_rational</span> <span class="identifier">v</span> <span class="special">=</span> <span class="number">1</span><span class="special">;</span> -<span class="comment">// Do some arithmetic:</span> -<span class="keyword">for</span><span class="special">(</span><span class="keyword">unsigned</span> <span class="identifier">i</span> <span class="special">=</span> <span class="number">1</span><span class="special">;</span> <span class="identifier">i</span> <span class="special"><=</span> <span class="number">1000</span><span class="special">;</span> <span class="special">++</span><span class="identifier">i</span><span class="special">)</span> - <span class="identifier">v</span> <span class="special">*=</span> <span class="identifier">i</span><span class="special">;</span> -<span class="identifier">v</span> <span class="special">/=</span> <span class="number">10</span><span class="special">;</span> + <span class="comment">// Do some arithmetic:</span> + <span class="keyword">for</span><span class="special">(</span><span class="keyword">unsigned</span> <span class="identifier">i</span> <span class="special">=</span> <span class="number">1</span><span class="special">;</span> <span class="identifier">i</span> <span class="special"><=</span> <span class="number">1000</span><span class="special">;</span> <span class="special">++</span><span class="identifier">i</span><span class="special">)</span> + <span class="identifier">v</span> <span class="special">*=</span> <span class="identifier">i</span><span class="special">;</span> + <span class="identifier">v</span> <span class="special">/=</span> <span class="number">10</span><span class="special">;</span> -<span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="identifier">v</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span> <span class="comment">// prints 1000! / 10</span> -<span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="identifier">numerator</span><span class="special">(</span><span class="identifier">v</span><span class="special">)</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span> -<span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="identifier">denominator</span><span class="special">(</span><span class="identifier">v</span><span class="special">)</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span> + <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="identifier">v</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span> <span class="comment">// prints 1000! / 10</span> + <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="identifier">numerator</span><span class="special">(</span><span class="identifier">v</span><span class="special">)</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span> + <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="identifier">denominator</span><span class="special">(</span><span class="identifier">v</span><span class="special">)</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span> -<span class="identifier">tom_rational</span> <span class="identifier">w</span><span class="special">(</span><span class="number">2</span><span class="special">,</span> <span class="number">3</span><span class="special">);</span> <span class="comment">// Component wise constructor</span> -<span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="identifier">w</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span> <span class="comment">// prints 2/3</span> + <span class="identifier">tom_rational</span> <span class="identifier">w</span><span class="special">(</span><span class="number">2</span><span class="special">,</span> <span class="number">3</span><span class="special">);</span> <span class="comment">// Component wise constructor</span> + <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="identifier">w</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span> <span class="comment">// prints 2/3</span> + + <span class="keyword">return</span> <span class="number">0</span><span class="special">;</span> +<span class="special">}</span> </pre> </div> <table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr> diff --git a/libs/multiprecision/doc/html/index.html b/libs/multiprecision/doc/html/index.html index da2d2ec60..c39180a69 100644 --- a/libs/multiprecision/doc/html/index.html +++ b/libs/multiprecision/doc/html/index.html @@ -163,7 +163,7 @@ </div> </div> <table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr> -<td align="left"><p><small>Last revised: June 30, 2014 at 12:16:48 GMT</small></p></td> +<td align="left"><p><small>Last revised: October 17, 2014 at 17:53:54 GMT</small></p></td> <td align="right"><div class="copyright-footer"></div></td> </tr></table> <hr> diff --git a/libs/multiprecision/doc/multiprecision.qbk b/libs/multiprecision/doc/multiprecision.qbk index 2bcce66dc..274302bda 100644 --- a/libs/multiprecision/doc/multiprecision.qbk +++ b/libs/multiprecision/doc/multiprecision.qbk @@ -410,8 +410,8 @@ The following back-ends provide integer arithmetic: enum cpp_integer_type { signed_magnitude, unsigned_magnitude }; enum cpp_int_check_type { checked, unchecked }; - template <unsigned MinDigits = 0, - unsigned MaxDits = 0, + template <unsigned MinBits = 0, + unsigned MaxBits = 0, cpp_integer_type SignType = signed_magnitude, cpp_int_check_type Checked = unchecked, class Allocator = std::allocator<limb_type> > @@ -419,8 +419,8 @@ The following back-ends provide integer arithmetic: // // Expression templates default to et_off if there is no allocator: // - template <unsigned MinDigits, unsigned MaxDigits, cpp_integer_type SignType, cpp_int_check_type Checked> - struct expression_template_default<cpp_int_backend<MinDigits, MaxDigits, SignType, Checked, void> > + template <unsigned MinBits, unsigned MaxBits, cpp_integer_type SignType, cpp_int_check_type Checked> + struct expression_template_default<cpp_int_backend<MinBits, MaxBits, SignType, Checked, void> > { static const expression_template_option value = et_off; }; typedef number<cpp_int_backend<> > cpp_int; // arbitrary precision integer @@ -1507,6 +1507,16 @@ In particular: mpz_int z(2); int i = z.template convert_to<int>(); // sets i to 2 +* Conversions to rational numbers from floating point ones are always allowed, and are exact and implicit +as long as the rational number uses an unbounded integer type. Please be aware that constructing a rational +number from an extended precision floating point type with a large exponent range can effectively run the system +out of memory, as in the extreme case ['2[super max_exponent] / CHAR_BITS] bytes of storage may be required. This +does not represent a problem for built in floating point types however, as the exponent range for these is rather +limited. + +* Conversions to floating point numbers from rational ones are rounded to nearest (less than 0.5ulp error) +as long as the floating point number is binary, and the integer type used by the rational number is unbounded. + Additional conversions may be supported by particular backends. * A `number` can be converted to any built in type, via an explicit conversion operator: @@ -2947,11 +2957,14 @@ which may be useful to ensure that columns line up. ``['unmentionable-expression-template-type]`` sinh (const ``['number-or-expression-template-type]``&); ``['unmentionable-expression-template-type]`` tanh (const ``['number-or-expression-template-type]``&); - ``['unmentionable-expression-template-type]`` ldexp (const ``['number-or-expression-template-type]``&, int); - ``['unmentionable-expression-template-type]`` frexp (const ``['number-or-expression-template-type]``&, int*); + ``['unmentionable-expression-template-type]`` ldexp (const ``['number-or-expression-template-type]``&, ``['integer-type]``); + ``['unmentionable-expression-template-type]`` frexp (const ``['number-or-expression-template-type]``&, ``['integer-type]``*); ``['unmentionable-expression-template-type]`` pow (const ``['number-or-expression-template-type]``&, const ``['number-or-expression-template-type]``&); ``['unmentionable-expression-template-type]`` fmod (const ``['number-or-expression-template-type]``&, const ``['number-or-expression-template-type]``&); ``['unmentionable-expression-template-type]`` atan2 (const ``['number-or-expression-template-type]``&, const ``['number-or-expression-template-type]``&); + ``['unmentionable-expression-template-type]`` scalbn(const ``['number-or-expression-template-type]``&, ``['integer-type]``); + ``['unmentionable-expression-template-type]`` logb (const ``['number-or-expression-template-type]``&); + ``['integer-type]`` ilogb (const ``['number-or-expression-template-type]``&); // Traits support: template <class T> @@ -3283,16 +3296,22 @@ that allows arithmetic to be performed on native integer types producing an exte ``['unmentionable-expression-template-type]`` sinh (const ``['number-or-expression-template-type]``&); ``['unmentionable-expression-template-type]`` tanh (const ``['number-or-expression-template-type]``&); - ``['unmentionable-expression-template-type]`` ldexp (const ``['number-or-expression-template-type]``&, int); - ``['unmentionable-expression-template-type]`` frexp (const ``['number-or-expression-template-type]``&, int*); + ``['unmentionable-expression-template-type]`` ldexp (const ``['number-or-expression-template-type]``&, ``['integer-type]``); + ``['unmentionable-expression-template-type]`` frexp (const ``['number-or-expression-template-type]``&, ``['integer-type]``*); ``['unmentionable-expression-template-type]`` pow (const ``['number-or-expression-template-type]``&, const ``['number-or-expression-template-type]``&); ``['unmentionable-expression-template-type]`` fmod (const ``['number-or-expression-template-type]``&, const ``['number-or-expression-template-type]``&); ``['unmentionable-expression-template-type]`` atan2 (const ``['number-or-expression-template-type]``&, const ``['number-or-expression-template-type]``&); + ``['unmentionable-expression-template-type]`` scalbn(const ``['number-or-expression-template-type]``&, ``['integer-type]``); + ``['unmentionable-expression-template-type]`` logb (const ``['number-or-expression-template-type]``&); + ``['integer-type]`` ilogb (const ``['number-or-expression-template-type]``&); These functions all behave exactly as their standard library C++11 counterparts do: their argument is either an instance of `number` or an expression template derived from it; If the argument is of type `number<Backend, et_off>` then that is also the return type, otherwise the return type is an expression template. +The integer type arguments to `ldexp`, `frexp`, `scalbn` and `ilogb` may be either type `int`, or the actual +type of the exponent of the number type. + These functions are normally implemented by the Backend type. However, default versions are provided for Backend types that don't have native support for these functions. Please note however, that this default support requires the precision of the type to be a compile time constant - this means for example that the [gmp] MPF Backend will not work with these functions when that type is @@ -4233,6 +4252,12 @@ and `ff` is a variable of type `std::ios_base::fmtflags`. The default version of this function is synthesised from other operations above.][[space]]] [[`eval_atan2(b, cb, cb2)`][`void`][Performs the equivalent operation to `std::atan` on arguments `cb` and `cb2`, and store the result in `b`. Only required when `B` is an floating-point type. The default version of this function is synthesised from other operations above.][[space]]] +[[`eval_scalbn(b, cb, e)`][`void`][Scales value `cb` by ['r[super e]], where ['r] is the radix of the type. The default version of this function + is implemented in terms of eval_ldexp, consequently this function must be provided for types with a radix other than 2.]] +[[`eval_ilogb(cb)`][`B::exponent_type`][Returns the exponent ['e] of value `cb` such that ['1 <= cb*r[super -e] < r], where ['r] is the radix of type B. + The default version of this function is implemented in terms of eval_frexp, consequently this function must be provided for types with a radix other than 2.]] +[[`eval_logb(b, cb)`][`B::exponent_type`][Sets `b` to the exponent ['e] of value `cb` such that ['1 <= cb*r[super -b] < r], where ['r] is the radix of type B. + The default version of this function is implemented in terms of `eval_ilogb`.]] ] When the tables above place no ['throws] requirements on an operation, then it is up to each type modelling this concept to @@ -4919,6 +4944,13 @@ Windows Vista machine. [section:hist History] +[h4 Multiprecision-2.2.3 (Boost-1.57)] + +* Changed rational to float conversions to exactly round to nearest, see [https://svn.boost.org/trac/boost/ticket/10085 10085]. +* Added improved generic float to rational conversions. +* Fixed rare bug in exponent function for __cpp_bin_float. +* Fixed various minor documentation issues. + [h4 Multiprecision-2.2.2 (Boost-1.56)] * Change floating point to rational conversions to be implicit, see [@https://svn.boost.org/trac/boost/ticket/10082 10082]. @@ -5015,10 +5047,8 @@ More a list of what ['could] be done, rather than what ['should] be done (which * Add back-end support for libdecNumber. * Add an adaptor back-end for complex number types. -* Add a back-end for MPFR interval arithmetic. * Add better multiplication routines (Karatsuba, FFT etc) to cpp_int_backend. * Add assembly level routines to cpp_int_backend. -* Add an all C++ Boost licensed binary floating point type. * Can ring types (exact floating point types) be supported? The answer should be yes, but someone needs to write it, the hard part is IO and binary-decimal conversion. * Should there be a choice of rounding mode (probably MPFR specific)? |