From: Matt Hurd (matt.hurd_at_[hidden])
Date: 2004-09-26 19:35:25
> Victor A. Wagner Jr. <vawjr_at_[hidden]> 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:
> 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;):
> 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.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk