[Bug libstdc++/47913] [C++0x] improve ratio_add to overflow less often

2011-05-04 Thread paolo.carlini at oracle dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47913 Paolo Carlini changed: What|Removed |Added Status|ASSIGNED|RESOLVED Resolution|

[Bug libstdc++/47913] [C++0x] improve ratio_add to overflow less often

2011-05-04 Thread paolo at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47913 --- Comment #24 from paolo at gcc dot gnu.org 2011-05-04 23:23:57 UTC --- Author: paolo Date: Wed May 4 23:23:54 2011 New Revision: 173400 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=173400 Log: 2011-05-04 Marc Glisse PR libst

[Bug libstdc++/47913] [C++0x] improve ratio_add to overflow less often

2011-05-04 Thread paolo.carlini at oracle dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47913 --- Comment #23 from Paolo Carlini 2011-05-04 17:56:19 UTC --- Nit (for the future): library patches are diffed from where the library ChangeLog is.

[Bug libstdc++/47913] [C++0x] improve ratio_add to overflow less often

2011-05-04 Thread paolo.carlini at oracle dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47913 Paolo Carlini changed: What|Removed |Added Status|UNCONFIRMED |ASSIGNED Last reconfirmed|

[Bug libstdc++/47913] [C++0x] improve ratio_add to overflow less often

2011-05-04 Thread marc.glisse at normalesup dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47913 --- Comment #21 from Marc Glisse 2011-05-04 16:27:28 UTC --- Created attachment 24182 --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=24182 first iteration in patch format Inserted in , with some cleanup of dead code, rewrite of ratio_less.

[Bug libstdc++/47913] [C++0x] improve ratio_add to overflow less often

2011-03-03 Thread paolo.carlini at oracle dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47913 --- Comment #20 from Paolo Carlini 2011-03-03 09:51:16 UTC --- Ah, ok then: when I looked a bit into boost::rational it seemed pretty simple, didn't notice that additional simplification. Thanks for the additional set of tests, anyway, as soon as

[Bug libstdc++/47913] [C++0x] improve ratio_add to overflow less often

2011-03-02 Thread marc.glisse at normalesup dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47913 --- Comment #19 from Marc Glisse 2011-03-03 06:41:45 UTC --- (In reply to comment #18) > I'm not sure to understand, I was under the impression that right now GCC is > essentially equal to boost::rational?!? That's the heuristic I was mentioning

[Bug libstdc++/47913] [C++0x] improve ratio_add to overflow less often

2011-03-02 Thread paolo.carlini at oracle dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47913 --- Comment #18 from Paolo Carlini 2011-03-02 23:21:07 UTC --- (In reply to comment #17) > Some more examples. Using the constants: > m=INTMAX_MAX; > n=INTMAX_MAX/2; > p=((intmax_t)1<<(4*sizeof(intmax_t)-1))-3 > > (m,2)-(m,3)==(m,6) boost shoul

[Bug libstdc++/47913] [C++0x] improve ratio_add to overflow less often

2011-03-02 Thread marc.glisse at normalesup dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47913 --- Comment #17 from Marc Glisse 2011-03-02 20:50:42 UTC --- Some more examples. Using the constants: m=INTMAX_MAX; n=INTMAX_MAX/2; p=((intmax_t)1<<(4*sizeof(intmax_t)-1))-3 (m,2)-(m,3)==(m,6) boost should manage this one (m/7*5-1,5)-(m-2,7)

[Bug libstdc++/47913] [C++0x] improve ratio_add to overflow less often

2011-03-02 Thread paolo.carlini at oracle dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47913 --- Comment #16 from Paolo Carlini 2011-03-02 14:59:23 UTC --- Done. Then we can add more tests to 47913.cc.

[Bug libstdc++/47913] [C++0x] improve ratio_add to overflow less often

2011-03-02 Thread paolo at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47913 --- Comment #15 from paolo at gcc dot gnu.org 2011-03-02 14:58:00 UTC --- Author: paolo Date: Wed Mar 2 14:57:57 2011 New Revision: 170616 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=170616 Log: 2011-03-02 Marc Glisse PR libst

[Bug libstdc++/47913] [C++0x] improve ratio_add to overflow less often

2011-03-02 Thread paolo.carlini at oracle dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47913 --- Comment #14 from Paolo Carlini 2011-03-02 14:14:55 UTC --- Excellent.

[Bug libstdc++/47913] [C++0x] improve ratio_add to overflow less often

2011-03-02 Thread marc.glisse at normalesup dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47913 --- Comment #13 from Marc Glisse 2011-03-02 14:05:23 UTC --- (In reply to comment #11) > Thanks for the attachment. Do you have a small testcase for it? I would test > here, commit, and then we can proceed with more serious changes for post > 4.

[Bug libstdc++/47913] [C++0x] improve ratio_add to overflow less often

2011-03-02 Thread paolo.carlini at oracle dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47913 --- Comment #12 from Paolo Carlini 2011-03-02 12:07:13 UTC --- About int/long/long long I see what you mean, but we should double check that __builtin_clzll is unconditionally available and the same as __builtin_clz if intmax_t == int (etc): at t

[Bug libstdc++/47913] [C++0x] improve ratio_add to overflow less often

2011-03-02 Thread paolo.carlini at oracle dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47913 --- Comment #11 from Paolo Carlini 2011-03-02 11:59:34 UTC --- Thanks for the attachment. Do you have a small testcase for it? I would test here, commit, and then we can proceed with more serious changes for post 4.6...

[Bug libstdc++/47913] [C++0x] improve ratio_add to overflow less often

2011-03-02 Thread marc.glisse at normalesup dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47913 --- Comment #10 from Marc Glisse 2011-03-02 11:53:58 UTC --- Created attachment 23512 --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=23512 avoid denominator overflows (untested)

[Bug libstdc++/47913] [C++0x] improve ratio_add to overflow less often

2011-03-02 Thread marc.glisse at normalesup dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47913 --- Comment #9 from Marc Glisse 2011-03-02 11:50:41 UTC --- (In reply to comment #8) > Right. Mine was sort of a general comment: the comments in ratio_less are also > rather terse ;) I'll try to expand a bit on them. > I don't think you should

[Bug libstdc++/47913] [C++0x] improve ratio_add to overflow less often

2011-03-02 Thread paolo.carlini at oracle dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47913 --- Comment #8 from Paolo Carlini 2011-03-02 10:59:06 UTC --- Hi, > > 1- Please make sure the code is minimally documented (are the comments in > > longlong.h enough?) > > Ok, I wasn't sure it was worth it if the code was unlikely to ever make

[Bug libstdc++/47913] [C++0x] improve ratio_add to overflow less often

2011-03-02 Thread marc.glisse at normalesup dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47913 --- Comment #7 from Marc Glisse 2011-03-02 09:59:52 UTC --- (In reply to comment #6) > 1- Please make sure the code is minimally documented (are the comments in > longlong.h enough?) Ok, I wasn't sure it was worth it if the code was unlikely to

[Bug libstdc++/47913] [C++0x] improve ratio_add to overflow less often

2011-03-01 Thread paolo.carlini at oracle dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47913 --- Comment #6 from Paolo Carlini 2011-03-01 23:00:05 UTC --- Thanks again for your help on this. Preliminarily, a few observations: 1- Please make sure the code is minimally documented (are the comments in longlong.h enough?); 2- I see stuff li

[Bug libstdc++/47913] [C++0x] improve ratio_add to overflow less often

2011-03-01 Thread marc.glisse at normalesup dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47913 --- Comment #5 from Marc Glisse 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 b

[Bug libstdc++/47913] [C++0x] improve ratio_add to overflow less often

2011-02-27 Thread paolo.carlini at oracle dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47913 Paolo Carlini changed: What|Removed |Added CC||paolo.carlini at oracle dot

[Bug libstdc++/47913] [C++0x] improve ratio_add to overflow less often

2011-02-27 Thread paolo.carlini at oracle dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47913 Paolo Carlini changed: What|Removed |Added AssignedTo|paolo.carlini at oracle dot |unassigned at gcc dot |

[Bug libstdc++/47913] [C++0x] improve ratio_add to overflow less often

2011-02-27 Thread marc.glisse at normalesup dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47913 --- Comment #2 from Marc Glisse 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:

[Bug libstdc++/47913] [C++0x] improve ratio_add to overflow less often

2011-02-27 Thread paolo.carlini at oracle dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47913 Paolo Carlini changed: What|Removed |Added AssignedTo|unassigned at gcc dot |paolo.carlini at oracle dot