|
Boost : |
From: Maxim Shemanarev (mcseem_at_[hidden])
Date: 2002-08-21 22:55:02
. . .
> >
> >In "x = y * z / u;", y * z is allowed to live in a FP register that has
> >better precision than 'x'.
>
> which is precisely what the OP was complaining that the language does NOT
> do for int (and it's relatives)
>
You're somewhat right, but not exactly. The thing is that floating point
calculations are much less restricted than fixed point ones (I consider ints
as a particular case of fixed point, remember PL/I). The principal
difference is that the precision of fixed point calculations is always
absolute, while the one of the floating point is relative. Floating point
calculations cannot even guarantee that if you do 0.3+0.3 you will have
exactly 0.6 and noone complains about it!
Integer arithmetic (and in general, the fixed-point one) is quite different.
It *must* give you the expected result. So, the question is not of the
interpretation of the expressions. The question is about to be closer to the
real world, namely to use some wide-spread possibilities of most popular
computational stones :-)
McSeem
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk