Boost logo

Boost :

Subject: Re: [boost] [rational] with optional over/underflow checking
From: John Maddock (boost.regex_at_[hidden])
Date: 2012-07-31 12:56:10


> 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.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk