http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47913
--- Comment #2 from Marc Glisse <marc.glisse at normalesup dot org> 2011-02-27 19:12:07 UTC --- (In reply to comment #1) > Looks like there is a pretty simple (eg, no continued fractions & co) way to > do > this: The continued fraction thing for ratio_less may actually be easier: - compare the integral parts - if they are equal, remove that integer and compare the inverses - have a terminating criterion (when denominators are 1?) > http://www.boost.org/doc/libs/1_46_0/boost/rational.hpp The runtime fraction addition in this file is what gcc currently does. I also looked at ratio.hpp (and what it includes), which factors out the gcd of the numerators and multiplies back with it at the end. That's a slight but fairly limited improvement, I'm sure we can do better.