
27 Sep
2004
27 Sep
'04
12:35 a.m.
Victor A. Wagner Jr. <vawjr@rudbek.com> wrote: The midpoint between them is (this is legal using your constraints):
a + (b-a)/2
1st year algebra teaches us that this is equivalent to:
(a+b)/2
While on most systems the intermediate value (a+b) would be useless, as soon as you divide by 2 it again becomes useful.
with a third pointer (T* c;):
(a+b+c)/3
becomes calculable and useful though clearly
Just a small $0.02... (a + b) is a dangerous thing in a 32 bit world full of arithmetic overflow opportunities. You'd have to have a very good reason for doing it this way I'd think. a + (a-b) / 2 is a bit safer. matt matthurd@acm.org