W
Walter Roberson
jacob navia said:We were speaking of operator overloading and I indicated that it is
well adapted for numeric types, and that other applications like
"abc"+"cde" --> "abccde" are wrong, since it violates some of the basic
rulmes of addition: a + b == b + a. That's why I said that. Not so
explicitely but that was my intention. In c++ this doesn't hold.
In IEEE 754 float arithmetic, x + y + z is not necessarily the same as
z + y + x, but you still consider this meaning of '+' to be acceptable.
(If x is negative epsilon, y is 1.0 and z is epsilon, then
x + y exists as a number less than 1.0 and adding back in epsilon
gives a different number, possibly 1.0; but if the operations
are done in another order, then (by definition) 1.0 + epsilon gives
1.0, and subtracting epsilon off of that gives a number which is
not 1.0; the two results are certain to be different for these
particular values. There are other situations in which the order
of operations can make a large cumulative difference.)