Boost C++ Libraries: Ticket #10364: Release 1.56 broke random::uniform_real_distribution https://svn.boost.org/trac10/ticket/10364 <p> Multiprecision random uniform_real_distribution&lt;mpf_float_50&gt; stopped working correctly with 1.56. It worked fine with 1.55, and the attached code is one of the examples that Boost documentation shows for this class. </p> <p> I have this problem manifesting on Mac OS X 10.9.4 under all the compilers I got: native clang from Xcode-5.1.1, clang++-mp-3.4 (macports clang v3.4.2), g++ v4.8.3. </p> <p> Attaching the complete source file that demonstrates the problem (35 lines of code), and the compiler output (748 lines of text). </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/10364 Trac 1.4.3 mouse008@… Sat, 16 Aug 2014 18:06:26 GMT attachment set https://svn.boost.org/trac10/ticket/10364 https://svn.boost.org/trac10/ticket/10364 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">boost-r3.cpp</span> </li> </ul> <p> Source code that demonstrates the problem </p> Ticket mouse008@… Sat, 16 Aug 2014 18:07:42 GMT attachment set https://svn.boost.org/trac10/ticket/10364 https://svn.boost.org/trac10/ticket/10364 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">b-r3.out</span> </li> </ul> <p> Compiler (clang-3.4.2 from macports) output demonstrating the problem. Same code compiles and runs fine with same compilers with boost_1_55_0. </p> Ticket Steven Watanabe Sat, 13 Feb 2016 17:48:03 GMT <link>https://svn.boost.org/trac10/ticket/10364#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/10364#comment:1</guid> <description> <p> I think that this is fixed in <a class="ext-link" href="https://github.com/boostorg/random/commit/d4514f1e075f43e5ea7b754529740442d091b6fe"><span class="icon">​</span>https://github.com/boostorg/random/commit/d4514f1e075f43e5ea7b754529740442d091b6fe</a>. </p> </description> <category>Ticket</category> </item> <item> <author>mouse008@…</author> <pubDate>Sun, 14 Feb 2016 14:31:09 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/10364#comment:2 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/10364#comment:2</guid> <description> <p> Not sure - I'm now on clang-3.7 and boost_1.59, with this problem persisting. When is this commit likely to end up in a release? </p> </description> <category>Ticket</category> </item> <item> <author>mouse008@…</author> <pubDate>Sun, 14 Feb 2016 14:38:15 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/10364#comment:3 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/10364#comment:3</guid> <description> <p> In fact, re-checking my 1.5 years old code, I see that a lot more of stuff that used GMP multi precision library and/or boost_random is broken now (under the current released clang, and the current released boost-1.59). Will post here soon. </p> </description> <category>Ticket</category> </item> <item> <author>Mouse <mouse008@…></author> <pubDate>Tue, 16 Feb 2016 02:58:01 GMT</pubDate> <title>attachment set https://svn.boost.org/trac10/ticket/10364 https://svn.boost.org/trac10/ticket/10364 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">b-r6b.out</span> </li> </ul> <p> Output of failed compilation of b-r6b.cpp </p> Ticket Mouse <mouse008@…> Tue, 16 Feb 2016 03:03:15 GMT <link>https://svn.boost.org/trac10/ticket/10364#comment:4 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/10364#comment:4</guid> <description> <p> Further checking shows that <code>uniform_real_distribution&lt;&gt; uc(-20.0, 20.0);</code> works (compiles and runs fine). <code>uniform_real_distribution&lt;mpf_float_50&gt; ur(-20.0, 20.0);</code> fails to compile (see attached output of compile attempt: <code>b-r6b.out</code>). </p> <p> This compiles and runs OK: </p> <pre class="wiki">#include &lt;iostream&gt; #include &lt;boost/multiprecision/gmp.hpp&gt; #include &lt;boost/multiprecision/random.hpp&gt; using namespace boost::multiprecision; using namespace boost::random; int main() { unsigned long long myseed = 0x12345670; mt19937 rgen(myseed); uniform_real_distribution&lt;&gt; uc(-20.0, 20.0); std::cout &lt;&lt; std::hex // &lt;&lt; std::showbase ; // // Generate some values: // std::cout &lt;&lt; std::setprecision(50); for(unsigned i = 0; i &lt; 20; ++i) std::cout &lt;&lt; std::setw(2) &lt;&lt; (i+1) &lt;&lt; ": " &lt;&lt; std::setw(20) &lt;&lt; uc(rgen) &lt;&lt; std::endl; std::cout &lt;&lt; std::endl; } </pre><p> giving this output: </p> <pre class="wiki">$ ./b-r6a 1: 17.07083447836339473724365234375 2: 18.59527722932398319244384765625 3: 17.2086485661566257476806640625 4: -7.10314041934907436370849609375 5: 12.02050872147083282470703125 6: 16.396274752914905548095703125 7: 18.85700456798076629638671875 8: 0.078481473028659820556640625 9: 4.03215981088578701019287109375 a: 3.56800344772636890411376953125 b: 4.79332183487713336944580078125 c: 0.429534278810024261474609375 d: 13.35449189879000186920166015625 e: -6.27208642661571502685546875 f: 13.10226154513657093048095703125 10: -8.06778541766107082366943359375 11: 6.47328031249344348907470703125 12: -9.097188748419284820556640625 13: 16.7489224486052989959716796875 14: 18.96312631666660308837890625 </pre><p> This does not compile (see the attached output): </p> <pre class="wiki">#include &lt;iostream&gt; #include &lt;boost/multiprecision/gmp.hpp&gt; #include &lt;boost/multiprecision/random.hpp&gt; using namespace boost::multiprecision; using namespace boost::random; int main() { unsigned long long myseed = 0x12345670; mt19937 rgen(myseed); independent_bits_engine&lt;mt19937, 100, mpf_float_50&gt; gen3(rgen); uniform_real_distribution&lt;mpf_float_50&gt; ur(-20.0, 20.0); std::cout &lt;&lt; std::hex // &lt;&lt; std::showbase ; // // Generate some values: // std::cout &lt;&lt; std::setprecision(50); for(unsigned i = 0; i &lt; 20; ++i) std::cout &lt;&lt; std::setw(2) &lt;&lt; (i+1) &lt;&lt; ": " &lt;&lt; std::setw(20) &lt;&lt; ur(gen3) &lt;&lt; " " &lt;&lt; ur(rgen) &lt;&lt; std::endl; std::cout &lt;&lt; std::endl; } </pre><p> Unfortunately I cannot test the proposed commit because I'm not building Boost myself (any more). I have to wait until the fix percolates down to the distributions, and Macports picks it up. :-( </p> </description> <category>Ticket</category> </item> <item> <author>Mouse <mouse008@…></author> <pubDate>Tue, 16 Feb 2016 03:17:23 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/10364#comment:5 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/10364#comment:5</guid> <description> <p> Note that the above code is copied almost verbatim from the Boost documentation: <a href="http://www.boost.org/doc/libs/1_59_0/libs/multiprecision/doc/html/boost_multiprecision/tut/random.html">http://www.boost.org/doc/libs/1_59_0/libs/multiprecision/doc/html/boost_multiprecision/tut/random.html</a>. </p> <p> (Copying really verbatim produces the same result.) </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Steven Watanabe</dc:creator> <pubDate>Tue, 16 Feb 2016 04:09:32 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/10364#comment:6 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/10364#comment:6</guid> <description> <p> The fix would be in 1.60. </p> </description> <category>Ticket</category> </item> <item> <author>Mouse <mouse008@…></author> <pubDate>Tue, 16 Feb 2016 13:14:55 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/10364#comment:7 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/10364#comment:7</guid> <description> <blockquote class="citation"> <p> The fix would be in 1.60. </p> </blockquote> <p> Thank you - I'm glad to hear that. </p> </description> <category>Ticket</category> </item> <item> <author>Mouse <mouse008@…></author> <pubDate>Tue, 16 Feb 2016 13:14:57 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/10364#comment:7 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/10364#comment:7</guid> <description> <blockquote class="citation"> <p> The fix would be in 1.60. </p> </blockquote> <p> Thank you - I'm glad to hear that. </p> </description> <category>Ticket</category> </item> <item> <author>Mouse <mouse008@…></author> <pubDate>Tue, 16 Feb 2016 13:20:39 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/10364#comment:8 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/10364#comment:8</guid> <description> <p> It still doesn't look fully fixed: </p> <pre class="wiki">#include &lt;iostream&gt; #include &lt;boost/multiprecision/gmp.hpp&gt; #include &lt;boost/multiprecision/random.hpp&gt; using namespace boost::multiprecision; using namespace boost::random; int main() { unsigned long long myseed = 0x12345670; mt19937 rgen(myseed); independent_bits_engine&lt;mt19937, 100, mpf_float_50&gt; gen3(rgen); uniform_real_distribution&lt;mpf_float_50&gt; ur(-20.0, 20.0); std::cout &lt;&lt; std::hex // &lt;&lt; std::showbase ; // // Generate some values: // std::cout &lt;&lt; std::setprecision(50); for(unsigned i = 0; i &lt; 20; ++i) std::cout &lt;&lt; std::setw(2) &lt;&lt; (i+1) &lt;&lt; ": " &lt;&lt; std::setw(20) &lt;&lt; ur(gen3) &lt;&lt; " " &lt;&lt; ur(rgen) &lt;&lt; std::endl; std::cout &lt;&lt; std::endl; } </pre><pre class="wiki">$ clang++ -o b-r6b -I ~/src/boost_1_60_0/include -I/opt/local/include b-r6b.cpp -L ~/src/boost_1_60_0/lib -lboost_system -lboost_filesystem -lboost_random -L/opt/local/lib -lgmp -lrdrand In file included from b-r6b.cpp:3: /Users/uri/src/boost_1_60_0/include/boost/multiprecision/random.hpp:12:10: warning: NOTE: Use of this header (boost/multiprecision/random.hpp) is deprecated: please use the random number library headers directly. [-W#pragma-messages] # pragma message("NOTE: Use of this header (boost/multiprecision/random.hpp... ^ In file included from b-r6b.cpp:3: In file included from /Users/uri/src/boost_1_60_0/include/boost/multiprecision/random.hpp:16: In file included from /Users/uri/src/boost_1_60_0/include/boost/random.hpp:38: /Users/uri/src/boost_1_60_0/include/boost/random/independent_bits.hpp:167:20: error: invalid operands to binary expression ('result_type' (aka 'boost::multiprecision::number&lt;boost::multiprecision::backends::gmp_float&lt;50&gt;, boost::multiprecision::expression_template_option::et_on&gt;') and 'std::size_t' (aka 'unsigned long')) S = (S &lt;&lt; w0) + (u &amp; y0_mask); ~ ^ ~~ /Users/uri/src/boost_1_60_0/include/boost/random/uniform_real_distribution.hpp:40:48: note: in instantiation of member function 'boost::random::independent_bits_engine&lt;boost::random::mersenne_twister_engine&lt;unsigned int, 32, 624, 397, 31, 2567483615, 11, 4294967295, 7, 2636928640, 15, 4022730752, 18, 1812433253&gt;, 100, boost::multiprecision::number&lt;boost::multiprecision::backends::gmp_float&lt;50&gt;, boost::multiprecision::expression_template_option::et_on&gt; &gt;::operator()' requested here result_type numerator = static_cast&lt;T&gt;(eng() - (eng.min)()); ^ /Users/uri/src/boost_1_60_0/include/boost/random/uniform_real_distribution.hpp:72:12: note: in instantiation of function template specialization 'boost::random::detail::generate_uniform_real&lt;boost::random::independent_bits_engine&lt;boost::random::mersenne_twister_engine&lt;unsigned int, 32, 624, 397, 31, 2567483615, 11, 4294967295, 7, 2636928640, 15, 4022730752, 18, 1812433253&gt;, 100, boost::multiprecision::number&lt;boost::multiprecision::backends::gmp_float&lt;50&gt;, boost::multiprecision::expression_template_option::et_on&gt; &gt;, boost::multiprecision::number&lt;boost::multiprecision::backends::gmp_float&lt;50&gt;, boost::multiprecision::expression_template_option::et_on&gt; &gt;' requested here return generate_uniform_real(eng, min_value, max_value, ^ /Users/uri/src/boost_1_60_0/include/boost/random/uniform_real_distribution.hpp:193:22: note: in instantiation of function template specialization 'boost::random::detail::generate_uniform_real&lt;boost::random::independent_bits_engine&lt;boost::random::mersenne_twister_engine&lt;unsigned int, 32, 624, 397, 31, 2567483615, 11, 4294967295, 7, 2636928640, 15, 4022730752, 18, 1812433253&gt;, 100, boost::multiprecision::number&lt;boost::multiprecision::backends::gmp_float&lt;50&gt;, boost::multiprecision::expression_template_option::et_on&gt; &gt;, boost::multiprecision::number&lt;boost::multiprecision::backends::gmp_float&lt;50&gt;, boost::multiprecision::expression_template_option::et_on&gt; &gt;' requested here { return detail::generate_uniform_real(eng, _min, _max); } ^ b-r6b.cpp:26:11: note: in instantiation of function template specialization 'boost::random::uniform_real_distribution&lt;boost::multiprecision::number&lt;boost::multiprecision::backends::gmp_float&lt;50&gt;, boost::multiprecision::expression_template_option::et_on&gt; &gt;::operator()&lt;boost::random::independent_bits_engine&lt;boost::random::mersenne_twister_engine&lt;unsigned int, 32, 624, 397, 31, 2567483615, 11, 4294967295, 7, 2636928640, 15, 4022730752, 18, 1812433253&gt;, 100, boost::multiprecision::number&lt;boost::multiprecision::backends::gmp_float&lt;50&gt;, boost::multiprecision::expression_template_option::et_on&gt; &gt; &gt;' requested here &lt;&lt; ur(gen3) &lt;&lt; " " ^ /Users/uri/src/boost_1_60_0/include/boost/optional/optional.hpp:1274:1: note: candidate template ignored: could not match 'basic_ostream' against 'number' operator&lt;&lt;(std::basic_ostream&lt;CharType, CharTrait&gt;&amp; os, optional_detail::opt... ^ /Users/uri/src/boost_1_60_0/include/boost/smart_ptr/shared_ptr.hpp:897:64: note: candidate template ignored: could not match 'basic_ostream' against 'number' template&lt;class E, class T, class Y&gt; std::basic_ostream&lt;E, T&gt; &amp; operator&lt;&lt; (s... ^ /Users/uri/src/boost_1_60_0/include/boost/format/format_class.hpp:118:9: note: candidate template ignored: could not match 'basic_ostream' against 'number' operator&lt;&lt;( std::basic_ostream&lt;Ch2, Tr2&gt; &amp; , ^ /Users/uri/src/boost_1_60_0/include/boost/multiprecision/detail/no_et_ops.hpp:274:4: note: candidate template ignored: could not match 0 against 1 operator &lt;&lt; (const number&lt;B, et_off&gt;&amp; a, const I&amp; b) ^ /Users/uri/src/boost_1_60_0/include/boost/multiprecision/detail/et_ops.hpp:599:4: note: candidate template ignored: substitution failure [with B = boost::multiprecision::backends::gmp_float&lt;50&gt;, I = unsigned long]: no type named 'type' in 'boost::enable_if_c&lt;false, boost::multiprecision::detail::expression&lt;boost::multiprecision::detail::shift_left, boost::multiprecision::number&lt;boost::multiprecision::backends::gmp_float&lt;50&gt;, boost::multiprecision::expression_template_option::et_on&gt;, unsigned long, void, void&gt; &gt;' operator &lt;&lt; (const number&lt;B, et_on&gt;&amp; a, const I&amp; b) ^ /Users/uri/src/boost_1_60_0/include/boost/multiprecision/detail/et_ops.hpp:606:7: note: candidate template ignored: could not match 'expression' against 'number' operator &lt;&lt; (const detail::expression&lt;tag, Arg1, Arg2, Arg3, Arg4&gt;&amp; a... ^ /Users/uri/src/boost_1_60_0/include/boost/multiprecision/number.hpp:1685:22: note: candidate template ignored: could not match 'number&lt;type-parameter-0-0, ExpressionTemplates&gt;' against 'unsigned long' inline std::ostream&amp; operator &lt;&lt; (std::ostream&amp; os, const number&lt;Backend, Ex... ^ In file included from b-r6b.cpp:3: In file included from /Users/uri/src/boost_1_60_0/include/boost/multiprecision/random.hpp:16: In file included from /Users/uri/src/boost_1_60_0/include/boost/random.hpp:38: /Users/uri/src/boost_1_60_0/include/boost/random/independent_bits.hpp:174:20: error: invalid operands to binary expression ('result_type' (aka 'boost::multiprecision::number&lt;boost::multiprecision::backends::gmp_float&lt;50&gt;, boost::multiprecision::expression_template_option::et_on&gt;') and 'unsigned long') S = (S &lt;&lt; (w0 + 1)) + (u &amp; y1_mask); ~ ^ ~~~~~~~~ /Users/uri/src/boost_1_60_0/include/boost/optional/optional.hpp:1274:1: note: candidate template ignored: could not match 'basic_ostream' against 'number' operator&lt;&lt;(std::basic_ostream&lt;CharType, CharTrait&gt;&amp; os, optional_detail::opt... ^ /Users/uri/src/boost_1_60_0/include/boost/smart_ptr/shared_ptr.hpp:897:64: note: candidate template ignored: could not match 'basic_ostream' against 'number' template&lt;class E, class T, class Y&gt; std::basic_ostream&lt;E, T&gt; &amp; operator&lt;&lt; (s... ^ /Users/uri/src/boost_1_60_0/include/boost/format/format_class.hpp:118:9: note: candidate template ignored: could not match 'basic_ostream' against 'number' operator&lt;&lt;( std::basic_ostream&lt;Ch2, Tr2&gt; &amp; , ^ /Users/uri/src/boost_1_60_0/include/boost/multiprecision/detail/no_et_ops.hpp:274:4: note: candidate template ignored: could not match 0 against 1 operator &lt;&lt; (const number&lt;B, et_off&gt;&amp; a, const I&amp; b) ^ /Users/uri/src/boost_1_60_0/include/boost/multiprecision/detail/et_ops.hpp:599:4: note: candidate template ignored: substitution failure [with B = boost::multiprecision::backends::gmp_float&lt;50&gt;, I = unsigned long]: no type named 'type' in 'boost::enable_if_c&lt;false, boost::multiprecision::detail::expression&lt;boost::multiprecision::detail::shift_left, boost::multiprecision::number&lt;boost::multiprecision::backends::gmp_float&lt;50&gt;, boost::multiprecision::expression_template_option::et_on&gt;, unsigned long, void, void&gt; &gt;' operator &lt;&lt; (const number&lt;B, et_on&gt;&amp; a, const I&amp; b) ^ /Users/uri/src/boost_1_60_0/include/boost/multiprecision/detail/et_ops.hpp:606:7: note: candidate template ignored: could not match 'expression' against 'number' operator &lt;&lt; (const detail::expression&lt;tag, Arg1, Arg2, Arg3, Arg4&gt;&amp; a... ^ /Users/uri/src/boost_1_60_0/include/boost/multiprecision/number.hpp:1685:22: note: candidate template ignored: could not match 'number&lt;type-parameter-0-0, ExpressionTemplates&gt;' against 'unsigned long' inline std::ostream&amp; operator &lt;&lt; (std::ostream&amp; os, const number&lt;Backend, Ex... ^ In file included from b-r6b.cpp:3: In file included from /Users/uri/src/boost_1_60_0/include/boost/multiprecision/random.hpp:16: In file included from /Users/uri/src/boost_1_60_0/include/boost/random.hpp:38: /Users/uri/src/boost_1_60_0/include/boost/random/independent_bits.hpp:240:81: error: invalid operands to binary expression ('boost::multiprecision::number&lt;boost::multiprecision::backends::gmp_float&lt;50&gt;, boost::multiprecision::expression_template_option::et_on&gt;' and 'unsigned long') ...&lt; std::numeric_limits&lt;UIntType&gt;::digits ? UIntType((UIntType(1) &lt;&lt; w) - 1) ... ~~~~~~~~~~~ ^ ~ /Users/uri/src/boost_1_60_0/include/boost/random/independent_bits.hpp:59:14: note: in instantiation of member function 'boost::random::independent_bits_engine&lt;boost::random::mersenne_twister_engine&lt;unsigned int, 32, 624, 397, 31, 2567483615, 11, 4294967295, 7, 2636928640, 15, 4022730752, 18, 1812433253&gt;, 100, boost::multiprecision::number&lt;boost::multiprecision::backends::gmp_float&lt;50&gt;, boost::multiprecision::expression_template_option::et_on&gt; &gt;::max_imp' requested here { return max_imp(boost::is_integral&lt;UIntType&gt;()); } ^ /Users/uri/src/boost_1_60_0/include/boost/random/uniform_real_distribution.hpp:41:51: note: in instantiation of member function 'boost::random::independent_bits_engine&lt;boost::random::mersenne_twister_engine&lt;unsigned int, 32, 624, 397, 31, 2567483615, 11, 4294967295, 7, 2636928640, 15, 4022730752, 18, 1812433253&gt;, 100, boost::multiprecision::number&lt;boost::multiprecision::backends::gmp_float&lt;50&gt;, boost::multiprecision::expression_template_option::et_on&gt; &gt;::max' requested here result_type divisor = static_cast&lt;T&gt;((eng.max)() - (eng.min)()); ^ /Users/uri/src/boost_1_60_0/include/boost/random/uniform_real_distribution.hpp:72:12: note: in instantiation of function template specialization 'boost::random::detail::generate_uniform_real&lt;boost::random::independent_bits_engine&lt;boost::random::mersenne_twister_engine&lt;unsigned int, 32, 624, 397, 31, 2567483615, 11, 4294967295, 7, 2636928640, 15, 4022730752, 18, 1812433253&gt;, 100, boost::multiprecision::number&lt;boost::multiprecision::backends::gmp_float&lt;50&gt;, boost::multiprecision::expression_template_option::et_on&gt; &gt;, boost::multiprecision::number&lt;boost::multiprecision::backends::gmp_float&lt;50&gt;, boost::multiprecision::expression_template_option::et_on&gt; &gt;' requested here return generate_uniform_real(eng, min_value, max_value, ^ /Users/uri/src/boost_1_60_0/include/boost/random/uniform_real_distribution.hpp:193:22: note: in instantiation of function template specialization 'boost::random::detail::generate_uniform_real&lt;boost::random::independent_bits_engine&lt;boost::random::mersenne_twister_engine&lt;unsigned int, 32, 624, 397, 31, 2567483615, 11, 4294967295, 7, 2636928640, 15, 4022730752, 18, 1812433253&gt;, 100, boost::multiprecision::number&lt;boost::multiprecision::backends::gmp_float&lt;50&gt;, boost::multiprecision::expression_template_option::et_on&gt; &gt;, boost::multiprecision::number&lt;boost::multiprecision::backends::gmp_float&lt;50&gt;, boost::multiprecision::expression_template_option::et_on&gt; &gt;' requested here { return detail::generate_uniform_real(eng, _min, _max); } ^ b-r6b.cpp:26:11: note: in instantiation of function template specialization 'boost::random::uniform_real_distribution&lt;boost::multiprecision::number&lt;boost::multiprecision::backends::gmp_float&lt;50&gt;, boost::multiprecision::expression_template_option::et_on&gt; &gt;::operator()&lt;boost::random::independent_bits_engine&lt;boost::random::mersenne_twister_engine&lt;unsigned int, 32, 624, 397, 31, 2567483615, 11, 4294967295, 7, 2636928640, 15, 4022730752, 18, 1812433253&gt;, 100, boost::multiprecision::number&lt;boost::multiprecision::backends::gmp_float&lt;50&gt;, boost::multiprecision::expression_template_option::et_on&gt; &gt; &gt;' requested here &lt;&lt; ur(gen3) &lt;&lt; " " ^ /Users/uri/src/boost_1_60_0/include/boost/optional/optional.hpp:1274:1: note: candidate template ignored: could not match 'basic_ostream' against 'number' operator&lt;&lt;(std::basic_ostream&lt;CharType, CharTrait&gt;&amp; os, optional_detail::opt... ^ /Users/uri/src/boost_1_60_0/include/boost/smart_ptr/shared_ptr.hpp:897:64: note: candidate template ignored: could not match 'basic_ostream' against 'number' template&lt;class E, class T, class Y&gt; std::basic_ostream&lt;E, T&gt; &amp; operator&lt;&lt; (s... ^ /Users/uri/src/boost_1_60_0/include/boost/format/format_class.hpp:118:9: note: candidate template ignored: could not match 'basic_ostream' against 'number' operator&lt;&lt;( std::basic_ostream&lt;Ch2, Tr2&gt; &amp; , ^ /Users/uri/src/boost_1_60_0/include/boost/multiprecision/detail/no_et_ops.hpp:274:4: note: candidate template ignored: could not match 0 against 1 operator &lt;&lt; (const number&lt;B, et_off&gt;&amp; a, const I&amp; b) ^ /Users/uri/src/boost_1_60_0/include/boost/multiprecision/detail/et_ops.hpp:599:4: note: candidate template ignored: substitution failure [with B = boost::multiprecision::backends::gmp_float&lt;50&gt;, I = unsigned long]: no type named 'type' in 'boost::enable_if_c&lt;false, boost::multiprecision::detail::expression&lt;boost::multiprecision::detail::shift_left, boost::multiprecision::number&lt;boost::multiprecision::backends::gmp_float&lt;50&gt;, boost::multiprecision::expression_template_option::et_on&gt;, unsigned long, void, void&gt; &gt;' operator &lt;&lt; (const number&lt;B, et_on&gt;&amp; a, const I&amp; b) ^ /Users/uri/src/boost_1_60_0/include/boost/multiprecision/detail/et_ops.hpp:606:7: note: candidate template ignored: could not match 'expression' against 'number' operator &lt;&lt; (const detail::expression&lt;tag, Arg1, Arg2, Arg3, Arg4&gt;&amp; a... ^ /Users/uri/src/boost_1_60_0/include/boost/multiprecision/number.hpp:1685:22: note: candidate template ignored: could not match 'number&lt;type-parameter-0-0, ExpressionTemplates&gt;' against 'unsigned long' inline std::ostream&amp; operator &lt;&lt; (std::ostream&amp; os, const number&lt;Backend, Ex... ^ 1 warning and 3 errors generated. $ </pre> </description> <category>Ticket</category> </item> <item> <dc:creator>Steven Watanabe</dc:creator> <pubDate>Tue, 16 Feb 2016 15:28:47 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/10364#comment:9 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/10364#comment:9</guid> <description> <p> The example code is wrong (It's been updated in the docs for 1.60). independent_bits_engine produces integers and must not be used with floating point types. </p> </description> <category>Ticket</category> </item> <item> <author>Mouse <mouse008@…></author> <pubDate>Wed, 17 Feb 2016 03:52:26 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/10364#comment:10 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/10364#comment:10</guid> <description> <blockquote class="citation"> <p> The example code is wrong (It's been updated in the docs for 1.60). </p> </blockquote> <p> Here's what I used to guide me: </p> <p> Boost-1.54 tutorial: <a href="http://www.boost.org/doc/libs/1_54_0/libs/multiprecision/doc/html/boost_multiprecision/tut/random.html">http://www.boost.org/doc/libs/1_54_0/libs/multiprecision/doc/html/boost_multiprecision/tut/random.html</a> </p> <p> Now the Boost-1.60 tutorial: <a href="http://www.boost.org/doc/libs/1_60_0/libs/multiprecision/doc/html/boost_multiprecision/tut/random.html">http://www.boost.org/doc/libs/1_60_0/libs/multiprecision/doc/html/boost_multiprecision/tut/random.html</a> suggests using <code>cpp_bin_float_50</code> instead of <code>mpf_float_50</code>, and <code>independent_bits_engine</code>. But it is unclear in this example how to specify a certain number of digits or bits for <code>uniform_real_distribution&lt;cpp_bin_float_50&gt;</code> that uses <code>independent_bits_engine&lt;nt19937, ...&gt;</code>. Perhaps you could point me at a description/tutorial? </p> <p> Thanks! </p> <p> P.S. I tried to replicate the last example from the above 1.60 tutorial, and here's the result. Am I doing something obviously wrong? This is with Boost-1.59. </p> <pre class="wiki">#include &lt;boost/multiprecision/cpp_bin_float.hpp&gt; #include &lt;boost/multiprecision/cpp_int.hpp&gt; #include &lt;boost/random.hpp&gt; int main() { using namespace boost::multiprecision; using namespace boost::random; // // Generate some distruted values: // uniform_real_distribution&lt;cpp_bin_float_50&gt; ur(-20, 20); gamma_distribution&lt;cpp_bin_float_50&gt; gd(20); independent_bits_engine&lt;mt19937, std::numeric_limits&lt;cpp_bin_float_50&gt;::digits, cpp_int&gt; gen; // // Generate some values: // std::cout &lt;&lt; std::setprecision(50); std::cout &lt;&lt; "uniform_real_distribution&lt;cpp_bin_float_50&gt; ur(-20, 20):" &lt;&lt; std::endl; for(unsigned i = 0; i &lt; 20; ++i) std::cout &lt;&lt; (i+1) &lt;&lt; ": " &lt;&lt; ur(gen) &lt;&lt; std::endl; std::cout &lt;&lt; std::endl; std::cout &lt;&lt; "gamma_distribution&lt;cpp_bin_float_50&gt; gd(20):" &lt;&lt; std::endl; for(unsigned i = 0; i &lt; 20; ++i) std::cout &lt;&lt; (i+1) &lt;&lt; ": " &lt;&lt; gd(gen) &lt;&lt; std::endl; std::cout &lt;&lt; std::endl; return 0; } </pre><pre class="wiki">$ make b-r6b clang++-mp-3.7 -maes -mpclmul -mrdrnd -msse2 -mssse3 -msse4.2 -mtune=native -Os -Ofast -std=c++11 -fPIC -m64 -msse4.2 -I/opt/local/include -Wno-comment -c b-r6b.cpp In file included from b-r6b.cpp:1: In file included from /opt/local/include/boost/multiprecision/cpp_bin_float.hpp:9: In file included from /opt/local/include/boost/multiprecision/cpp_int.hpp:12: In file included from /opt/local/include/boost/multiprecision/number.hpp:22: In file included from /opt/local/include/boost/multiprecision/detail/generic_interconvert.hpp:9: In file included from /opt/local/include/boost/multiprecision/detail/default_ops.hpp:10: In file included from /opt/local/include/boost/multiprecision/detail/number_base.hpp:17: In file included from /opt/local/include/boost/lexical_cast.hpp:32: In file included from /opt/local/include/boost/lexical_cast/try_lexical_convert.hpp:35: In file included from /opt/local/include/boost/lexical_cast/detail/converter_lexical.hpp:54: In file included from /opt/local/include/boost/lexical_cast/detail/converter_lexical_streams.hpp:77: /opt/local/include/boost/integer.hpp:138:6: error: static_assert failed "No suitable unsigned integer type with the requested number of bits is available." BOOST_STATIC_ASSERT_MSG(Bits &lt;= (int)(sizeof(boost::uintmax_t) * CHAR_BIT), ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /opt/local/include/boost/static_assert.hpp:31:45: note: expanded from macro 'BOOST_STATIC_ASSERT_MSG' # define BOOST_STATIC_ASSERT_MSG( ... ) static_assert(__VA_ARGS__) ^ ~~~~~~~~~~~ /opt/local/include/boost/integer/integer_mask.hpp:63:22: note: in instantiation of template class 'boost::uint_t&lt;168&gt;' requested here typedef typename uint_t&lt;Bits&gt;::least least; ^ /opt/local/include/boost/random/independent_bits.hpp:58:21: note: in instantiation of template class 'boost::low_bits_mask_t&lt;168&gt;' requested here { return boost::low_bits_mask_t&lt;w&gt;::sig_bits; } ^ /opt/local/include/boost/random/uniform_real_distribution.hpp:41:51: note: in instantiation of member function 'boost::random::independent_bits_engine&lt;boost::random::mersenne_twister_engine&lt;unsigned int, 32, 624, 397, 31, 2567483615, 11, 4294967295, 7, 2636928640, 15, 4022730752, 18, 1812433253&gt;, 168, boost::multiprecision::number&lt;boost::multiprecision::backends::cpp_int_backend&lt;0, 0, boost::multiprecision::cpp_integer_type::signed_magnitude, boost::multiprecision::cpp_int_check_type::unchecked, std::__1::allocator&lt;unsigned long long&gt; &gt;, boost::multiprecision::expression_template_option::et_on&gt; &gt;::max' requested here result_type divisor = static_cast&lt;T&gt;((eng.max)() - (eng.min)()); ^ /opt/local/include/boost/random/uniform_real_distribution.hpp:72:12: note: in instantiation of function template specialization 'boost::random::detail::generate_uniform_real&lt;boost::random::independent_bits_engine&lt;boost::random::mersenne_twister_engine&lt;unsigned int, 32, 624, 397, 31, 2567483615, 11, 4294967295, 7, 2636928640, 15, 4022730752, 18, 1812433253&gt;, 168, boost::multiprecision::number&lt;boost::multiprecision::backends::cpp_int_backend&lt;0, 0, boost::multiprecision::cpp_integer_type::signed_magnitude, boost::multiprecision::cpp_int_check_type::unchecked, std::__1::allocator&lt;unsigned long long&gt; &gt;, boost::multiprecision::expression_template_option::et_on&gt; &gt;, boost::multiprecision::number&lt;boost::multiprecision::backends::cpp_bin_float&lt;50, boost::multiprecision::backends::digit_base_type::digit_base_10, void, int, 0, 0&gt;, boost::multiprecision::expression_template_option::et_off&gt; &gt;' requested here return generate_uniform_real(eng, min_value, max_value, ^ /opt/local/include/boost/random/uniform_real_distribution.hpp:193:22: note: in instantiation of function template specialization 'boost::random::detail::generate_uniform_real&lt;boost::random::independent_bits_engine&lt;boost::random::mersenne_twister_engine&lt;unsigned int, 32, 624, 397, 31, 2567483615, 11, 4294967295, 7, 2636928640, 15, 4022730752, 18, 1812433253&gt;, 168, boost::multiprecision::number&lt;boost::multiprecision::backends::cpp_int_backend&lt;0, 0, boost::multiprecision::cpp_integer_type::signed_magnitude, boost::multiprecision::cpp_int_check_type::unchecked, std::__1::allocator&lt;unsigned long long&gt; &gt;, boost::multiprecision::expression_template_option::et_on&gt; &gt;, boost::multiprecision::number&lt;boost::multiprecision::backends::cpp_bin_float&lt;50, boost::multiprecision::backends::digit_base_type::digit_base_10, void, int, 0, 0&gt;, boost::multiprecision::expression_template_option::et_off&gt; &gt;' requested here { return detail::generate_uniform_real(eng, _min, _max); } ^ b-r6b.cpp:21:38: note: in instantiation of function template specialization 'boost::random::uniform_real_distribution&lt;boost::multiprecision::number&lt;boost::multiprecision::backends::cpp_bin_float&lt;50, boost::multiprecision::backends::digit_base_type::digit_base_10, void, int, 0, 0&gt;, boost::multiprecision::expression_template_option::et_off&gt; &gt;::operator()&lt;boost::random::independent_bits_engine&lt;boost::random::mersenne_twister_engine&lt;unsigned int, 32, 624, 397, 31, 2567483615, 11, 4294967295, 7, 2636928640, 15, 4022730752, 18, 1812433253&gt;, 168, boost::multiprecision::number&lt;boost::multiprecision::backends::cpp_int_backend&lt;0, 0, boost::multiprecision::cpp_integer_type::signed_magnitude, boost::multiprecision::cpp_int_check_type::unchecked, std::__1::allocator&lt;unsigned long long&gt; &gt;, boost::multiprecision::expression_template_option::et_on&gt; &gt; &gt;' requested here std::cout &lt;&lt; (i+1) &lt;&lt; ": " &lt;&lt; ur(gen) &lt;&lt; std::endl; ^ In file included from b-r6b.cpp:3: In file included from /opt/local/include/boost/random.hpp:36: In file included from /opt/local/include/boost/random/additive_combine.hpp:27: In file included from /opt/local/include/boost/random/linear_congruential.hpp:32: In file included from /opt/local/include/boost/random/detail/seed_impl.hpp:20: /opt/local/include/boost/integer/integer_mask.hpp:64:36: error: no type named 'fast' in 'boost::uint_t&lt;168&gt;' typedef typename uint_t&lt;Bits&gt;::fast fast; ~~~~~~~~~~~~~~~~~~~~~~~^~~~ /opt/local/include/boost/random/independent_bits.hpp:58:21: note: in instantiation of template class 'boost::low_bits_mask_t&lt;168&gt;' requested here { return boost::low_bits_mask_t&lt;w&gt;::sig_bits; } ^ /opt/local/include/boost/random/uniform_real_distribution.hpp:41:51: note: in instantiation of member function 'boost::random::independent_bits_engine&lt;boost::random::mersenne_twister_engine&lt;unsigned int, 32, 624, 397, 31, 2567483615, 11, 4294967295, 7, 2636928640, 15, 4022730752, 18, 1812433253&gt;, 168, boost::multiprecision::number&lt;boost::multiprecision::backends::cpp_int_backend&lt;0, 0, boost::multiprecision::cpp_integer_type::signed_magnitude, boost::multiprecision::cpp_int_check_type::unchecked, std::__1::allocator&lt;unsigned long long&gt; &gt;, boost::multiprecision::expression_template_option::et_on&gt; &gt;::max' requested here result_type divisor = static_cast&lt;T&gt;((eng.max)() - (eng.min)()); ^ /opt/local/include/boost/random/uniform_real_distribution.hpp:72:12: note: in instantiation of function template specialization 'boost::random::detail::generate_uniform_real&lt;boost::random::independent_bits_engine&lt;boost::random::mersenne_twister_engine&lt;unsigned int, 32, 624, 397, 31, 2567483615, 11, 4294967295, 7, 2636928640, 15, 4022730752, 18, 1812433253&gt;, 168, boost::multiprecision::number&lt;boost::multiprecision::backends::cpp_int_backend&lt;0, 0, boost::multiprecision::cpp_integer_type::signed_magnitude, boost::multiprecision::cpp_int_check_type::unchecked, std::__1::allocator&lt;unsigned long long&gt; &gt;, boost::multiprecision::expression_template_option::et_on&gt; &gt;, boost::multiprecision::number&lt;boost::multiprecision::backends::cpp_bin_float&lt;50, boost::multiprecision::backends::digit_base_type::digit_base_10, void, int, 0, 0&gt;, boost::multiprecision::expression_template_option::et_off&gt; &gt;' requested here return generate_uniform_real(eng, min_value, max_value, ^ /opt/local/include/boost/random/uniform_real_distribution.hpp:193:22: note: in instantiation of function template specialization 'boost::random::detail::generate_uniform_real&lt;boost::random::independent_bits_engine&lt;boost::random::mersenne_twister_engine&lt;unsigned int, 32, 624, 397, 31, 2567483615, 11, 4294967295, 7, 2636928640, 15, 4022730752, 18, 1812433253&gt;, 168, boost::multiprecision::number&lt;boost::multiprecision::backends::cpp_int_backend&lt;0, 0, boost::multiprecision::cpp_integer_type::signed_magnitude, boost::multiprecision::cpp_int_check_type::unchecked, std::__1::allocator&lt;unsigned long long&gt; &gt;, boost::multiprecision::expression_template_option::et_on&gt; &gt;, boost::multiprecision::number&lt;boost::multiprecision::backends::cpp_bin_float&lt;50, boost::multiprecision::backends::digit_base_type::digit_base_10, void, int, 0, 0&gt;, boost::multiprecision::expression_template_option::et_off&gt; &gt;' requested here { return detail::generate_uniform_real(eng, _min, _max); } ^ b-r6b.cpp:21:38: note: in instantiation of function template specialization 'boost::random::uniform_real_distribution&lt;boost::multiprecision::number&lt;boost::multiprecision::backends::cpp_bin_float&lt;50, boost::multiprecision::backends::digit_base_type::digit_base_10, void, int, 0, 0&gt;, boost::multiprecision::expression_template_option::et_off&gt; &gt;::operator()&lt;boost::random::independent_bits_engine&lt;boost::random::mersenne_twister_engine&lt;unsigned int, 32, 624, 397, 31, 2567483615, 11, 4294967295, 7, 2636928640, 15, 4022730752, 18, 1812433253&gt;, 168, boost::multiprecision::number&lt;boost::multiprecision::backends::cpp_int_backend&lt;0, 0, boost::multiprecision::cpp_integer_type::signed_magnitude, boost::multiprecision::cpp_int_check_type::unchecked, std::__1::allocator&lt;unsigned long long&gt; &gt;, boost::multiprecision::expression_template_option::et_on&gt; &gt; &gt;' requested here std::cout &lt;&lt; (i+1) &lt;&lt; ": " &lt;&lt; ur(gen) &lt;&lt; std::endl; ^ In file included from b-r6b.cpp:3: In file included from /opt/local/include/boost/random.hpp:40: In file included from /opt/local/include/boost/random/lagged_fibonacci.hpp:30: /opt/local/include/boost/random/uniform_01.hpp:177:40: error: no type named 'result_type' in 'boost::multiprecision::number&lt;boost::multiprecision::backends::cpp_bin_float&lt;50, boost::multiprecision::backends::digit_base_type::digit_base_10, void, int, 0, 0&gt;, boost::multiprecision::expression_template_option::et_off&gt;' typedef typename traits::value_type::result_type base_result; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~ /opt/local/include/boost/random/uniform_01.hpp:235:12: note: in instantiation of template class 'boost::random::detail::backward_compatible_uniform_01&lt;boost::multiprecision::number&lt;boost::multiprecision::backends::cpp_bin_float&lt;50, boost::multiprecision::backends::digit_base_type::digit_base_10, void, int, 0, 0&gt;, boost::multiprecision::expression_template_option::et_off&gt;, double&gt;' requested here : public detail::select_uniform_01&lt;UniformRandomNumberGenerator&gt;::BOOST_NE... ^ /opt/local/include/boost/random/gamma_distribution.hpp:175:42: note: in instantiation of template class 'boost::random::uniform_01&lt;boost::multiprecision::number&lt;boost::multiprecision::backends::cpp_bin_float&lt;50, boost::multiprecision::backends::digit_base_type::digit_base_10, void, int, 0, 0&gt;, boost::multiprecision::expression_template_option::et_off&gt;, double&gt;' requested here result_type y = tan(pi * uniform_01&lt;RealType&gt;()(eng)); ^ b-r6b.cpp:25:38: note: in instantiation of function template specialization 'boost::random::gamma_distribution&lt;boost::multiprecision::number&lt;boost::multiprecision::backends::cpp_bin_float&lt;50, boost::multiprecision::backends::digit_base_type::digit_base_10, void, int, 0, 0&gt;, boost::multiprecision::expression_template_option::et_off&gt; &gt;::operator()&lt;boost::random::independent_bits_engine&lt;boost::random::mersenne_twister_engine&lt;unsigned int, 32, 624, 397, 31, 2567483615, 11, 4294967295, 7, 2636928640, 15, 4022730752, 18, 1812433253&gt;, 168, boost::multiprecision::number&lt;boost::multiprecision::backends::cpp_int_backend&lt;0, 0, boost::multiprecision::cpp_integer_type::signed_magnitude, boost::multiprecision::cpp_int_check_type::unchecked, std::__1::allocator&lt;unsigned long long&gt; &gt;, boost::multiprecision::expression_template_option::et_on&gt; &gt; &gt;' requested here std::cout &lt;&lt; (i+1) &lt;&lt; ": " &lt;&lt; gd(gen) &lt;&lt; std::endl; ^ In file included from b-r6b.cpp:3: In file included from /opt/local/include/boost/random.hpp:61: In file included from /opt/local/include/boost/random/chi_squared_distribution.hpp:20: /opt/local/include/boost/random/gamma_distribution.hpp:180:20: error: type 'uniform_01&lt;boost::multiprecision::number&lt;boost::multiprecision::backends::cpp_bin_float&lt;50, boost::multiprecision::backends::digit_base_type::digit_base_10, void, int, 0, 0&gt;, boost::multiprecision::expression_template_option::et_off&gt; &gt;' does not provide a call operator if(uniform_01&lt;RealType&gt;()(eng) &gt; ^~~~~~~~~~~~~~~~~~~~~~ b-r6b.cpp:25:38: note: in instantiation of function template specialization 'boost::random::gamma_distribution&lt;boost::multiprecision::number&lt;boost::multiprecision::backends::cpp_bin_float&lt;50, boost::multiprecision::backends::digit_base_type::digit_base_10, void, int, 0, 0&gt;, boost::multiprecision::expression_template_option::et_off&gt; &gt;::operator()&lt;boost::random::independent_bits_engine&lt;boost::random::mersenne_twister_engine&lt;unsigned int, 32, 624, 397, 31, 2567483615, 11, 4294967295, 7, 2636928640, 15, 4022730752, 18, 1812433253&gt;, 168, boost::multiprecision::number&lt;boost::multiprecision::backends::cpp_int_backend&lt;0, 0, boost::multiprecision::cpp_integer_type::signed_magnitude, boost::multiprecision::cpp_int_check_type::unchecked, std::__1::allocator&lt;unsigned long long&gt; &gt;, boost::multiprecision::expression_template_option::et_on&gt; &gt; &gt;' requested here std::cout &lt;&lt; (i+1) &lt;&lt; ": " &lt;&lt; gd(gen) &lt;&lt; std::endl; ^ In file included from b-r6b.cpp:3: In file included from /opt/local/include/boost/random.hpp:61: In file included from /opt/local/include/boost/random/chi_squared_distribution.hpp:20: In file included from /opt/local/include/boost/random/gamma_distribution.hpp:25: /opt/local/include/boost/random/exponential_distribution.hpp:132:42: error: type 'uniform_01&lt;boost::multiprecision::number&lt;boost::multiprecision::backends::cpp_bin_float&lt;50, boost::multiprecision::backends::digit_base_type::digit_base_10, void, int, 0, 0&gt;, boost::multiprecision::expression_template_option::et_off&gt; &gt;' does not provide a call operator _lambda * log(result_type(1)-uniform_01&lt;RealType&gt;()(eng)); ^~~~~~~~~~~~~~~~~~~~~~ /opt/local/include/boost/random/gamma_distribution.hpp:170:20: note: in instantiation of function template specialization 'boost::random::exponential_distribution&lt;boost::multiprecision::number&lt;boost::multiprecision::backends::cpp_bin_float&lt;50, boost::multiprecision::backends::digit_base_type::digit_base_10, void, int, 0, 0&gt;, boost::multiprecision::expression_template_option::et_off&gt; &gt;::operator()&lt;boost::random::independent_bits_engine&lt;boost::random::mersenne_twister_engine&lt;unsigned int, 32, 624, 397, 31, 2567483615, 11, 4294967295, 7, 2636928640, 15, 4022730752, 18, 1812433253&gt;, 168, boost::multiprecision::number&lt;boost::multiprecision::backends::cpp_int_backend&lt;0, 0, boost::multiprecision::cpp_integer_type::signed_magnitude, boost::multiprecision::cpp_int_check_type::unchecked, std::__1::allocator&lt;unsigned long long&gt; &gt;, boost::multiprecision::expression_template_option::et_on&gt; &gt; &gt;' requested here return _exp(eng) * _beta; ^ b-r6b.cpp:25:38: note: in instantiation of function template specialization 'boost::random::gamma_distribution&lt;boost::multiprecision::number&lt;boost::multiprecision::backends::cpp_bin_float&lt;50, boost::multiprecision::backends::digit_base_type::digit_base_10, void, int, 0, 0&gt;, boost::multiprecision::expression_template_option::et_off&gt; &gt;::operator()&lt;boost::random::independent_bits_engine&lt;boost::random::mersenne_twister_engine&lt;unsigned int, 32, 624, 397, 31, 2567483615, 11, 4294967295, 7, 2636928640, 15, 4022730752, 18, 1812433253&gt;, 168, boost::multiprecision::number&lt;boost::multiprecision::backends::cpp_int_backend&lt;0, 0, boost::multiprecision::cpp_integer_type::signed_magnitude, boost::multiprecision::cpp_int_check_type::unchecked, std::__1::allocator&lt;unsigned long long&gt; &gt;, boost::multiprecision::expression_template_option::et_on&gt; &gt; &gt;' requested here std::cout &lt;&lt; (i+1) &lt;&lt; ": " &lt;&lt; gd(gen) &lt;&lt; std::endl; ^ 5 errors generated. make: *** [b-r6b.o] Error 1 </pre> </description> <category>Ticket</category> </item> <item> <author>Mouse <mouse008@…></author> <pubDate>Wed, 17 Feb 2016 03:56:37 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/10364#comment:11 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/10364#comment:11</guid> <description> <p> Adding <code>#include &lt;boost/multiprecision/random.hpp&gt;</code> to the above source code fixed the problem. ??? </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Steven Watanabe</dc:creator> <pubDate>Wed, 17 Feb 2016 04:06:35 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/10364#comment:12 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/10364#comment:12</guid> <description> <p> Replying to <a class="ticket" href="https://svn.boost.org/trac10/ticket/10364#comment:10" title="Comment 10">Mouse &lt;mouse008@…&gt;</a>: </p> <blockquote class="citation"> <p> Now the Boost-1.60 tutorial: <a href="http://www.boost.org/doc/libs/1_60_0/libs/multiprecision/doc/html/boost_multiprecision/tut/random.html">http://www.boost.org/doc/libs/1_60_0/libs/multiprecision/doc/html/boost_multiprecision/tut/random.html</a> suggests using <code>cpp_bin_float_50</code> instead of <code>mpf_float_50</code>, and <code>independent_bits_engine</code>. But it is unclear in this example how to specify a certain number of digits or bits for <code>uniform_real_distribution&lt;cpp_bin_float_50&gt;</code> that uses <code>independent_bits_engine&lt;nt19937, ...&gt;</code>. Perhaps you could point me at a description/tutorial? </p> </blockquote> <p> uniform_real_distribution uses the same number of bits as the underlying generator. Just set the number of bits of independent_bits_engine to what you need. </p> <blockquote class="citation"> <p> P.S. I tried to replicate the last example from the above 1.60 tutorial, and here's the result. Am I doing something obviously wrong? This is with Boost-1.59. </p> </blockquote> <p> You're using 1.59. The fixes to Boost.Random to support multiprecision weren't merged until 1.60. </p> </description> <category>Ticket</category> </item> <item> <author>Mouse <mouse008@…></author> <pubDate>Wed, 17 Feb 2016 14:40:18 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/10364#comment:13 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/10364#comment:13</guid> <description> <p> Got it, thanks! </p> <p> I guess we can close this ticket. </p> </description> <category>Ticket</category> </item> </channel> </rss>