Boost C++ Libraries: Ticket #7879: Optimize equality comparison https://svn.boost.org/trac10/ticket/7879 <p> Comparing two numbers for equality should be trivial. However, current implementation uses one or two less-then operators. For rational numbers this is very inefficient because less-then operator is both complex and slow. </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/7879 Trac 1.4.3 Stepan Podoskin <stepik-777@…> Thu, 10 Jan 2013 23:23:41 GMT type changed https://svn.boost.org/trac10/ticket/7879#comment:1 https://svn.boost.org/trac10/ticket/7879#comment:1 <ul> <li><strong>type</strong> <span class="trac-field-old">Bugs</span> → <span class="trac-field-new">Feature Requests</span> </li> </ul> Ticket Stepan Podoskin <stepik-777@…> Fri, 11 Jan 2013 15:44:23 GMT <link>https://svn.boost.org/trac10/ticket/7879#comment:2 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/7879#comment:2</guid> <description> <p> Also, as I see, <code>rational&lt;IntType&gt;::operator&lt;</code> is overcomplicated. It uses some complex algorithm, I think it is to prevent overflow. But with arbitrary-sized integers it can be as simple as <code>a.num*b.den &lt; b.num*a.den</code> (and also we need to take care about signs). It should be faster than current algorithm that uses divisions. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>John Maddock</dc:creator> <pubDate>Sat, 12 Jan 2013 11:08:58 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/7879#comment:3 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/7879#comment:3</guid> <description> <p> You're correct of course, in fact rational_adapter is needlessly slow because of it's dependence on Boost.Rational which often performs a lot of unnecessary copying. </p> <p> I really need to rewrite rational_adapter not to use Boost.Rational at all. </p> <p> BTW the front end does have the ability to optimize comparisons when a full compare is expensive, but since we can't access the numerator and denominator of Boost.Rational without copying, it's unlikely to help so much as it should. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Domagoj Šarić</dc:creator> <pubDate>Fri, 11 Oct 2013 13:07:14 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/7879#comment:4 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/7879#comment:4</guid> <description> <p> Wouldn't it be more worth while to merge this effort with improving Boost.Rational ('to kill more flies with a similar amount of effort)? </p> </description> <category>Ticket</category> </item> </channel> </rss>