Does anyone know how best to cope with floating point errors in the FFT calculation process? The problem is that these errors accumulate because of all the summations. They are especially annoying when computing the phase for a given frequency component:
atan(imaginary / real) can give quite a significant phase shift if both real and imaginary are tiny due to a floating point truncation, but of the same order.
The only solution I have come up with so far is to look at the maximum magnitude in the signal and disregard any frequency with a magnitude of under 1% of the maximum value and set it's real part to 0 so the phase comes out as NaN. However, this seems a little clumsy to me. Any better ideas would be most welcome.