Hi Stefan,
Herfried tells me it's called the "round-to-even" rule. And now I
understand Charles' post.
I found the following explanation on the Net.
===================================
The result of any arithmetic operation involving floating-point quantities
is rounded to the nearest representable floating-point number (or to ±? if out
of range). In case of ties, where the unrounded result is exactly halfway
between two floating-point numbers, one chooses the one that has a last binary
digit of 0 (the rule of round to even.) The only exception to this rule is
that conversions of floating-point to integer types, using a cast such as
(int) x, always truncate-that is, round to the number nearest to 0, throwing
the fractional part away.
The justifications for the round-to-even rule are subtle. In computations
involving many floating-point operations, it can help avoid biasing the
arithmetic error in any particular direction. It also has the very interesting
property of preventing drift in certain computations. Suppose, for example,
that a certain loop has the effect of computing
x = (x + y) - y;
on each of many iterations (you wouldn't do this explicitly, of course,
but it may happen to one of your variables for certain particular values of
the input data). The round-to-even rule guarantees that the value of x here
will change at most once, and then drift no further.
===================================
I don't like it. The idea that CInt (3 / 2) = CInt (5 / 2) ?? Yuck!!
Regards,
Fergus