http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47913
Summary: [C++0x] improve ratio_add to overflow less often Product: gcc Version: 4.6.0 Status: UNCONFIRMED Severity: enhancement Priority: P3 Component: libstdc++ AssignedTo: unassig...@gcc.gnu.org ReportedBy: marc.gli...@normalesup.org ratio_add currently computes something like: gcd=gcd(den1,den2) num=num1*(den2/gcd)+num2*(den1/gcd) den=den1*(den2/gcd) gcd2=gcd(num,den) num/=gcd2 den/=gcd2 In cases where gcd2 is not 1, the computation may overflow whereas the final result would fit. Even without that, it is possible that one or both of the terms added in num are too large but their sum is not. As a quality of implementation issue, it would be nice to reduce those cases a bit. But that comes far far behind the ratio_less improvement described in PR 42622.