public void update(double sample) {
        // Adjust min&max
        min = (sample < min ? sample : min);
        max = (sample > max ? sample : max);

        // Update average
        average += (sample - average) / ++count;
        _pwrSumAverage += ( sample * sample - _pwrSumAverage) / count;

        // Update variance
        stdDev = Math.sqrt((_pwrSumAverage * count - count * average * average) / (count - 1));
        cv = 100 * (stdDev / average);
    }
public void update ( double sample ) { min = ( sample < min ? sample : min ) ; max = ( sample > max ? sample : max ) ; average += ( sample - average ) / ++ count ; _pwrSumAverage += ( sample * sample - _pwrSumAverage ) / count ; stdDev = Math . sqrt ( ( _pwrSumAverage * count - count * average * average ) / ( count - 1 ) ) ; cv = 100 * ( stdDev / average ) ; }
Updates statistics with 'sample'
<p>
@param sample a sample added to the series