From: Dave Abrahams (abrahams_at_[hidden])
Date: 1999-12-05 13:50:21
> [Disclaimer: I've skimmed rational.hpp, rather than having read & inwardly
> digested it!]
>> 1. Rationals are stored as normalised (numerator, denominator) pairs. This
>> has the advantage of simplicity. I don't see the normalisation cost as
>> critical, but I'm willing to listen to arguments.
> There are certain situations where not doing the normalisation is
> advantageous (for interests sake, the case I'm thinking of right now is that
> in some of the American financial markets, prices are quoted as fractions.
> Most options traders aren't aware that 8/16 is the same as 1/2 - but then,
> these are people that use numbers like 100.23&16/32...which means 100.235.
> Of course, the simple fact that there _is_ a cost for normalisation could
> be seen as an argument against it happening automatically. If one wants the
> normalisation to take place, then one can do the normalisation explicitly.
> (Assuming normalise() is made publicly accessible, of course)
It's easy to overflow after a few additions if you don't normalize.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk