[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [sc-dev] [APPROVE] Adding a RunningAverage UGen

On Apr 18, 2004, at 3:33 PM, Ross Bencina wrote:

        //update sum
        sum -=data[count];
        float next= ZXP(in);
        next *= next;
        data[count]= next;
        sum += next;

This is not stable for floating point variables. Rounding errors can
accumulate in sum.

This was discussed in a thread on music-dsp last November under the topic
"floating point running sum optimization".

That is why I suggested in that thread to convert to integer first before you store in the delay line. You then avoid the rounding issue entirely.