I'm writing some code which calculates some averages. Obviously, the traditional way to calculate any average is to add up all the values, and then divide by the number of values.
However, in the mechanism I'm working on, I find it much easier to add and calculate the averages one at a time, as in add a new value to the averaged total, and then divide by two each time (since each time there are two numbers being added). But I'm not sure how accurate it would be.
Can I calculate averages this way? Or is it not reliable?
NOTE: I began writing this question originally, and while coming up with an example, found my answer. So I added an answer with my question at the same time.
answer your own questionat the same time as asking. They were literally posted at precisely the same time as each other. Other SE sites are perfectly okay with doing so. This is the first SE site which someone has said I shouldn't. $\endgroup$