|
Boost : |
From: Andras Erdei (aerdei_at_[hidden])
Date: 2005-04-06 03:06:39
whenever we do arithmetic, we are doing some kind of rational arithmetic:
- integer arithmetic is rational arithmetic with all denominators equal to 1
- fixed point arithmetic is rational arithmetic with all denominators being a
pre-specified constant
- floating point arithmetic is rational arithmetic with denominator values
limited to powers of 2 (e.g. 1/3 is represented as 11184811/2^25)
- finite rational<> arithmetic is rational arithmetic with denominator values
limited to a given range
the first three does rounding, so the rule of thumb "behave like int" suggests
rational<> should do the same. if we do not do rounding, we have to have some
very good reasons for not doing it.
br,
andras
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk