Boost C++ Libraries: Ticket #8692: setting mpfr precision uses wrong precision and trashes value https://svn.boost.org/trac10/ticket/8692 <p> <a class="ext-link" href="http://svn.boost.org/svn/boost/trunk/boost/multiprecision/mpfr.hpp"><span class="icon">​</span>http://svn.boost.org/svn/boost/trunk/boost/multiprecision/mpfr.hpp</a> Two bugs in boost/multiprecision/mpfr.hpp:920-923 </p> <ol><li>set_prec trashes the value, should use prec_round </li><li>precision is converted from bits to digits10, should be from digits10 to bits </li></ol><pre class="wiki">void precision(unsigned digits10) BOOST_NOEXCEPT { mpfr_set_prec(this-&gt;m_data, multiprecision::detail::digits2_2_10((digits10))); } </pre><p> should be more like </p> <pre class="wiki">void precision(unsigned digits10) BOOST_NOEXCEPT { mpfr_prec_round(this-&gt;m_data, multiprecision::detail::digits10_2_2((digits10)), GMP_RNDN); } </pre> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/8692 Trac 1.4.3 John Maddock Thu, 13 Jun 2013 16:22:00 GMT <link>https://svn.boost.org/trac10/ticket/8692#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/8692#comment:1</guid> <description> <p> (In <a class="changeset" href="https://svn.boost.org/trac10/changeset/84763" title="Apply patch from #8692. Refs #8692.">[84763]</a>) Apply patch from <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/8692" title="#8692: Bugs: setting mpfr precision uses wrong precision and trashes value (closed: fixed)">#8692</a>. Refs <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/8692" title="#8692: Bugs: setting mpfr precision uses wrong precision and trashes value (closed: fixed)">#8692</a>. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>John Maddock</dc:creator> <pubDate>Sat, 15 Jun 2013 17:38:47 GMT</pubDate> <title>status changed; resolution set https://svn.boost.org/trac10/ticket/8692#comment:2 https://svn.boost.org/trac10/ticket/8692#comment:2 <ul> <li><strong>status</strong> <span class="trac-field-old">new</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">fixed</span> </li> </ul> <p> (In <a class="changeset" href="https://svn.boost.org/trac10/changeset/84799" title="Merge fixes for from Trunk. Fixes #8692. Fixes #8670. Fixes #8667.">[84799]</a>) Merge fixes for from Trunk. Fixes <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/8692" title="#8692: Bugs: setting mpfr precision uses wrong precision and trashes value (closed: fixed)">#8692</a>. Fixes <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/8670" title="#8670: Bugs: Bug in handling 0 mod n (closed: fixed)">#8670</a>. Fixes <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/8667" title="#8667: Bugs: gmp_int wrongly assumes m_data is initialised on copy assignment (closed: fixed)">#8667</a>. </p> Ticket