Boost C++ Libraries: Ticket #8160: multiprecision: Number is not assigned after dividing zero by something. https://svn.boost.org/trac10/ticket/8160 <pre class="wiki"> #include &lt;iostream&gt; #include &lt;boost/multiprecision/cpp_int.hpp&gt; using boost::multiprecision::cpp_int; int main() { cpp_int a = 1; a = 0/cpp_int("1"); std::cout &lt;&lt; "a = " &lt;&lt; a &lt;&lt; "\n"; // a = 1 return 0; } </pre><p> divide.hpp: line 341 says <em> All the limbs in x are zero, so is the result: </em></p> <p> However, result is not assigned to zero. </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/8160 Trac 1.4.3 Stepan Podoskin <stepik-777@…> Sat, 23 Feb 2013 20:25:06 GMT attachment set https://svn.boost.org/trac10/ticket/8160 https://svn.boost.org/trac10/ticket/8160 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">fix.patch</span> </li> </ul> <p> patch "boost/multiprecision" </p> Ticket Stepan Podoskin <stepik-777@…> Sun, 24 Feb 2013 10:12:28 GMT summary changed https://svn.boost.org/trac10/ticket/8160#comment:1 https://svn.boost.org/trac10/ticket/8160#comment:1 <ul> <li><strong>summary</strong> <span class="trac-field-old">multiprecision: Number is not assinned after dividing zero by something.</span> → <span class="trac-field-new">multiprecision: Number is not assigned after dividing zero by something.</span> </li> </ul> Ticket John Maddock Sun, 24 Feb 2013 11:10:33 GMT <link>https://svn.boost.org/trac10/ticket/8160#comment:2 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/8160#comment:2</guid> <description> <p> Confirmed. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>John Maddock</dc:creator> <pubDate>Sun, 24 Feb 2013 13:20:49 GMT</pubDate> <title>status changed; resolution set https://svn.boost.org/trac10/ticket/8160#comment:3 https://svn.boost.org/trac10/ticket/8160#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> (In <a class="changeset" href="https://svn.boost.org/trac10/changeset/83128" title="Fix bug in division of zero. Document and add tests. Fixes #8160.">[83128]</a>) Fix bug in division of zero. Document and add tests. Fixes <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/8160" title="#8160: Bugs: multiprecision: Number is not assigned after dividing zero by something. (closed: fixed)">#8160</a>. </p> Ticket Stepan Podoskin <stepik-777@…> Sun, 24 Feb 2013 17:27:45 GMT <link>https://svn.boost.org/trac10/ticket/8160#comment:4 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/8160#comment:4</guid> <description> <p> I just want to note that comparison with zero here isn't necessary. </p> <p> There is: </p> <pre class="wiki"> if((r_order == 0) &amp;&amp; (*pr == 0)) </pre><p> And few lines below: </p> <pre class="wiki"> if((r_order == 0) &amp;&amp; (*pr &lt; y)) </pre><p> There is no reason to treat zero as some special value, it will be handled by second <strong>if</strong>, so lines 339-345 can be simply removed. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>John Maddock</dc:creator> <pubDate>Mon, 25 Feb 2013 16:32:06 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/8160#comment:5 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/8160#comment:5</guid> <description> <p> Um.. clearly the bug I have at present has eaten my brains away :-( </p> <p> Will fix shortly, thanks for your patience! </p> </description> <category>Ticket</category> </item> <item> <dc:creator>John Maddock</dc:creator> <pubDate>Mon, 25 Feb 2013 16:33:02 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/8160#comment:6 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/8160#comment:6</guid> <description> <p> (In <a class="changeset" href="https://svn.boost.org/trac10/changeset/83153" title="Better fix for #8160. Refs #8160.">[83153]</a>) Better fix for <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/8160" title="#8160: Bugs: multiprecision: Number is not assigned after dividing zero by something. (closed: fixed)">#8160</a>. Refs <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/8160" title="#8160: Bugs: multiprecision: Number is not assigned after dividing zero by something. (closed: fixed)">#8160</a>. </p> </description> <category>Ticket</category> </item> </channel> </rss>