Boost C++ Libraries: Ticket #8065: Multiprecision rounding issue https://svn.boost.org/trac10/ticket/8065 <p> When running the attached program, rounding issues occur. The program shifts a boost::multiprecision::cpp_dec_float&lt;N&gt;(1) by N digits left, then calls the round method and shifts back to the right. The round method fails to truncate the 0.5 it adds for some N. The issue becomes worse if you shift even further to the left or use a higher initial value. The problematic code seems to be in cpp_dec_float&lt;&gt;::extract_integer_part, which decides that no truncation is required, although the guard digits are not zero. For me, removing the whole else if (exp &gt;=...) {} clause seemed to fix it. </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/8065 Trac 1.4.3 Matthias Wagner <MWagner@…> Thu, 14 Feb 2013 15:32:34 GMT attachment set https://svn.boost.org/trac10/ticket/8065 https://svn.boost.org/trac10/ticket/8065 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">MPRoundingBug.cpp</span> </li> </ul> Ticket John Maddock Thu, 14 Feb 2013 16:42:00 GMT cc changed https://svn.boost.org/trac10/ticket/8065#comment:1 https://svn.boost.org/trac10/ticket/8065#comment:1 <ul> <li><strong>cc</strong> <span class="trac-author">e_float@…</span> added; <span class="trac-author">John Maddock</span> removed </li> </ul> <p> Chris, can you take a look at this one? </p> <p> Many thanks, John. </p> Ticket christopher_kormanyos Sat, 16 Feb 2013 10:55:09 GMT <link>https://svn.boost.org/trac10/ticket/8065#comment:2 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/8065#comment:2</guid> <description> <p> (In <a class="changeset" href="https://svn.boost.org/trac10/changeset/82920" title="Refs #8065">[82920]</a>) Refs <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/8065" title="#8065: Bugs: Multiprecision rounding issue (closed: fixed)">#8065</a> </p> </description> <category>Ticket</category> </item> <item> <dc:creator>John Maddock</dc:creator> <pubDate>Thu, 18 Apr 2013 18:07:22 GMT</pubDate> <title>status changed; resolution set https://svn.boost.org/trac10/ticket/8065#comment:3 https://svn.boost.org/trac10/ticket/8065#comment:3 <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> Closing as this is fixed now. </p> Ticket