Hi, All,

I cannot understand why the phase accumulator should be limited to

[-16*pi,16*pi]. Please clarify it for me if you have some ideas on it.

The following is the code in this class:

if (fabs (d_phase) > 16 * M_PI){

double ii = trunc (d_phase / (2 * M_PI));

d_phase = d_phase - (ii * 2 * M_PI);

}

Fangming

2009/11/9 fangming he [email protected]:

Hi, All,

I cannot understand why the phase accumulator should be limited to

[-16*pi,16*pi]. Please clarify it for me if you have some ideas on it.

The following is the code in this class:

if (fabs (d_phase) > 16 * M_PI){

double ii = trunc (d_phase / (2 * M_PI));

d_phase = d_phase - (ii * 2 * M_PI);

}

My guess is that there is still only so much precision in a floating

point number. Knowing you are going to reduce the phase down modulo

2*pi, when dealing with large numbers, the error really starts to

accumulate.

Try it out. Take a phase value and add 2*pi, then reduce that large*

number down by 2pi. How many iterations does it take before you have

a significant error?

This is only a guess and by no means anything else. If someone more

knowledgeable would like to shed some light, please do so.

Brian