Help me understand this simple code snippet to get the magnitude frequency response I inherited the following FFT code to get the magnitude frequency response of a sample window. I understand what fft() does. What I don't understand are the lines marked with a "???". What do they do? In particular the "real[i]/real.length/2" portion and the multiplication and division by 1000 portion.

double[] real = new double[_FFTSize];
double[] imaginary = new double[_FFTSize];

loadDataIntoReal(real);

fft(real, imaginary); // in-place FFT

for (int i = 0; i &lt; spectrum.length; i++)
{
    double reValue =((int)((real[i]/(real.length/2))*1000)/1000.0); // ???
    double imValue =((int)((imaginary[i]/(real.length/2))*1000)/1000.0); // ???
    double value = Math.sqrt(reValue * reValue + imValue * imValue);
    spectrum[i] = value;
}


Each line seems to have a redundant multiplication and division by 1000. However, if I change the code to be the following, then I get slightly different floating-point results, so I guess they must provide some sort of precision.

    double reValue =(real[i]/(real.length/2));
    double imValue =(imaginary[i]/(real.length/2));
It looks like this mul-floor-div is an incorrect attempt to limit some numeric print-out to 3 or 6 decimal places.  Better to do that during the print formatting.