Boost C++ Libraries: Ticket #35: Self division wrong in template rational https://svn.boost.org/trac10/ticket/35 <pre class="wiki">The definition of operator /= for class template rational does not handle self divisions (as in r /= r;) correctly: num = (num/gcd1) * (r.den/gcd2); den = (den/gcd2) * (r.num/gcd1); This code should be changed to: IntType rnum = r.num; num = (num/gcd1) * (r.den/gcd2); den = (den/gcd2) * (rnum/gcd1); Another solution would be to add: if(this == &amp;r) { num = den = IntType(1); return *this; } </pre> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/35 Trac 1.4.3 Markus Schöpflin Tue, 22 Nov 2005 15:23:51 GMT status changed https://svn.boost.org/trac10/ticket/35#comment:1 https://svn.boost.org/trac10/ticket/35#comment:1 <ul> <li><strong>status</strong> <span class="trac-field-old">assigned</span> → <span class="trac-field-new">closed</span> </li> </ul> <pre class="wiki">Logged In: YES user_id=91733 See http://cvs.sourceforge.net/viewcvs.py/boost/boost/boost/rational.hpp?r1=1.10&amp;r2=1.11 Was fixed by this check-in in Feb 2002, therefore closed. </pre> Ticket