Assembly Averaging
scotta
Posts: 168
I have 5 numbers in 5 RES variables.
A1
A2
A3
A4
A5
How do I toss the high and low values, then average ?
A1
A2
A3
A4
A5
How do I toss the high and low values, then average ?
Comments
Post Edited (Mike Green) : 3/5/2007 6:49:02 PM GMT
something like this before it clicks.
Sorry I didn't get back to you on this sooner.
Thanks,
Scott
1) Accumulating a total of the points
2) Determining the maximum of the points
3) Determining the minimum of the points
4) At the end: Divide the total by the # of points
So:
1) At the beginning, we initialize MaxVal, MinVal, and Total to the 1st value
2) For each subsequent point (A2 - A5), we add it into the Total, use the max
instruction to determine the minimum value (I know it seems backwards,
but there it is ... It does work this way ... Look carefully at the instruction
description) and the min instruction to determine the maximum value.
3) There's a simple division by a constant (the number of points). Note that
I messed up with the constant value. It should be 5, not 3.
Mike
Thanks. You're absolutely correct. I forgot about the "tossing the max and min values". Oh well, I guess I'm more confused than usual today.
Mike