Chris-42
if no samples are inserted the call of getAvg() causes a devision by zero error. Will be great if it is returning 0 in this case.
#15 · closed · 1 comments
if no samples are inserted the call of getAvg() causes a devision by zero error. Will be great if it is returning 0 in this case.
It can be argued that would be mathematically incorrect, but if that is the desired behavior, then I would recommend something like: ```c++ movingAvg ma(10); int myAvg = ma.getCount() ? ma.getAvg() : 0; ``` See also #7.