title: Accuracy of Cooley-Tukey FFT - float versus double
body: <p>I heard about non accuracy of float FFT, especially of cos and sin function - there are totally different numbers compared with double.</p>
  
  <p>I ask because I re-write some code - Cooley-Tukey FFT algorithm; and the results are different. The original project uses double and new one is float. Is that my error? And I write this code from matlab and c++... and little ask the double of matlab is the same like java and c+ double?? </p>
  
  <pre><code>float  PI=3.141592;
  // Make sure n is a power of 2
  // if (n != (1 &lt;&lt; m))
  //    throw new RuntimeException("FFT length must be power of 2");
  
  // precompute tables
  
   for (int i = 0; i &lt; n / 2; i++) {
       cosa[i] = cos (-2 * PI * i / n);
       sina[i] =sin (-2 * PI * i / n);
   }
  </code></pre>