Boost C++ Libraries: Ticket #8670: Bug in handling 0 mod n https://svn.boost.org/trac10/ticket/8670 <p> The following code produces as outputs the numbers 5933326056 and 0. </p> <pre class="wiki">#include &lt;iostream&gt; #include &lt;boost/multiprecision/cpp_int.hpp&gt; using namespace std; int main() { typedef boost::multiprecision::checked_int1024_t bigint; bigint n = 5933326056; bigint z = 0; cout &lt;&lt; (z % n) &lt;&lt; endl; cout &lt;&lt; (0 % 5933326056) &lt;&lt; endl; } </pre> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/8670 Trac 1.4.3 John Maddock Sun, 09 Jun 2013 16:18:39 GMT <link>https://svn.boost.org/trac10/ticket/8670#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/8670#comment:1</guid> <description> <p> (In <a class="changeset" href="https://svn.boost.org/trac10/changeset/84716" title="Fix for 0 % N giving wrong answer in cpp_int. Refs #8670.">[84716]</a>) Fix for 0 % N giving wrong answer in cpp_int. Refs <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>. </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/8670#comment:2 https://svn.boost.org/trac10/ticket/8670#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