Boost logo

Boost :

From: Schoenborn, Oliver (oliver.schoenborn_at_[hidden])
Date: 2002-02-21 15:14:43


> 2. I have read that a rational number class is being considered. I do
> not think there is any one 'best' way to represent rational numbers.
> One use of rational numbers is for exact computations. But
> arithimetic can quickly max out any fixed representation.

Isn't this true only if the representation is in the form n/m for n,m
belonging to [int_type_min,int_type_max]? But if you take out the
non-decimal part, ie. factor every number as k+n/m, then n/m is always
between 0 and 1, and the triplet (k,n,m) adequately represents rational
numbers over a very large range. If still insufficient, you could probably
factor it into a quadruplet (k,j,n,m) where all are ints and describe a
number of the form k.10^j +n/m.

Then again, maybe this is not at all what you meant by the above statement
8}

Oliver


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