Boost C++ Libraries: Ticket #13160: cpp_dec_float fails division with on MinGW7.1 with optimization -O2 https://svn.boost.org/trac10/ticket/13160 <p> When compiling the following on MinGW 7.1 with option -O2, the assertion fires. </p> <p> It succeeds (as expected) with: -O3 debug (no optimization) -m64 (in all configurations) </p> <pre class="wiki">#include &lt;cassert&gt; #include &lt;boost/multiprecision/cpp_dec_float.hpp&gt; typedef boost::multiprecision::number&lt;boost::multiprecision::cpp_dec_float&lt;50&gt; &gt; flp_type; int main() { flp_type v1("1.33"); flp_type v2(50); v1 /= v2; assert(v1 == flp_type("0.0266")); return 0; } </pre> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/13160 Trac 1.4.3 John Maddock Tue, 26 Dec 2017 12:10:16 GMT status changed; resolution set https://svn.boost.org/trac10/ticket/13160#comment:1 https://svn.boost.org/trac10/ticket/13160#comment:1 <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">duplicate</span> </li> </ul> <p> Duplicates: <a class="new ticket" href="https://svn.boost.org/trac10/ticket/11178" title="#11178: Bugs: cpp_dec_float calculation bug (new)">#11178</a> </p> <p> I'm afraid division in cpp_dec_float is not exact - which is to say it doesn't round to the closest decimal, but stores guard digits instead. </p> Ticket