From: Andy Little (andy_at_[hidden])
Date: 2005-04-02 05:35:48
"Andy Little" <andy_at_[hidden]> wrote
> There is a safe range of values for each operation.
> eg for an implementation of rational addition where Rationalx = Nx/ Dx
> and operator + is implemented as :
> (N1 * D2 + N2 * D1 ) "/ "(D1 * D2)
FWIW if one limited values to the contiguous range scheme in my previous post, I
think that the 'naive' algorithm above (+ rational.normalize() )gives
significantly better speed and memory performance than the addition calc in
current version of boost::rational. This is probably also true of other
The current implementation is making assumptions about the integer used as the
value_type, and may not be optimal for a bigint value_type either.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk