This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug libstdc++/47913] [C++0x] improve ratio_add to overflow less often
- From: "marc.glisse at normalesup dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Tue, 1 Mar 2011 22:15:58 +0000
- Subject: [Bug libstdc++/47913] [C++0x] improve ratio_add to overflow less often
- Auto-submitted: auto-generated
- References: <bug-47913-4@http.gcc.gnu.org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47913
--- Comment #5 from Marc Glisse <marc.glisse at normalesup dot org> 2011-03-01 22:15:48 UTC ---
Created attachment 23509
--> http://gcc.gnu.org/bugzilla/attachment.cgi?id=23509
Overkill
I was having a hard time making it nice and clean, so I went for totally
overkill. It might be a bit scary to have 200 lines of code just to implement
an addition. And questionable whether avoiding a few overflows is worth the
complication. On the plus side, it makes it possible to give a simpler
implementation of ratio_less. And __safe_add can be removed (24 lines).
I'll try again to come up with a simpler solution.