
John Maddock <boost.regex <at> virgin.net> writes:
Would there be any interest in a modified "rational" class template/header that optionally allows for an exception be generated if there is under/overflow during any of the operations? I have been developing such a template, where the new defaulted bool template parameter would generate the class exactly as before to preserve the original stable implementation, and to support unlimited-precision integer where over/underflow would not be possible. Setting the new template parameter to true, however would generate code that adds the over/underflow checking.
This must be useful, but must mesh with Multiprecision (provided Multiprecision is accepted).
I'm sure John Maddock will have some views on this (if he isn't already plotting something .
I'm plotting on watching more Olympics
This sounds like a good idea, but I'd just point out that I found the performance of Boost.Rational to be pretty abysmal, particularly when used with UDT's (lots and lots of copying at the very least). Can't help but wonder if there isn't a better way - assuming someone is willing to take it on!
John.
Speeding rational up could be done as well, but the original question was is there any interest in a rational that optionally supports over/underflow checking. As mentioned previously, the new template parameter would control if the checking code were generated, or the original implementation. The original implementation would be great for Multiprecision integer types, and in fact, the checking code should be prevented from being used if the integer type is Multiprecision (type trait checks would be used to insure this). I'm ready to submit this code (or code change), make changes/fixes, update test cases, etc. but what would be the proper channel? Via the sandbox area?, post a big diff? The last discussion I saw on rational was on about 12/12/04, so there is the question of a current maintainer in the mix as well.