On Wednesday 15 August 2007, Andrew Talbot wrote: > Kuba Ober wrote: > >> You calculating center wrong: > >> > + ret = (props->lMax-props->lMin)/2; > >> > >> This won't work for min=1000 max=2000. > > > > But it does. Maybe you meant if min/max were switched? In such case > > > > ret = (props->lMax-props->lMin)/2; > > if (props->lMax < props->lMin) ret = -ret; > > > > Cheers, Kuba > > If ret is meant to have a value that is half way between props->lMax and > props->lMin, then I believe there should be a "+" between them, not a "-". > In other words: > > ret = (props->lMax + props->lMin) / 2;
Yeah, another case of one (me) reading what one wants to see, rather than reading what's really there. I feel hilarious, having suggested a non-fix (ret = -ret) ;) Cheers, Kuba