title: KissFFT output returns nan value?
body: <p>currently i m working on the Tizen IDE.</p>
  
  <p>I had read the input data from the MicroPhone and Try to apply FFT on it...
  but everytime I gets the nan output from the FFT.</p>
  
  <p>Here is my code..</p>
  
  <pre><code>ShortBuffer *pBuffer1 = pData-&gt;AsShortBufferN();
  
  fft = new KissFFT(BUFFER_SIZE);
  
  std::vector&lt;short&gt; input(pBuffer1-&gt;GetPointer(),
          pBuffer1-&gt;GetPointer() + BUFFER_SIZE); // this contains audio data
  std::vector&lt;float&gt; specturm(BUFFER_SIZE);
  
  fft-&gt;spectrum(input, specturm);
  </code></pre>
  
  <p>applying FFT</p>
  
  <pre><code>void KissFFT::spectrum(KissFFTO* fft, std::vector&lt;short&gt;&amp; samples2,
          std::vector&lt;float&gt;&amp; spectrum) {
  
  
      int len = fft-&gt;numSamples / 2 + 1;
  
      kiss_fft_scalar* samples = (kiss_fft_scalar*) &amp;samples2[0];
  
      kiss_fftr(fft-&gt;config, samples, fft-&gt;spectrum);
  
      for (int i = 0; i &lt; len; i++) {
  
          float re = scale(fft-&gt;spectrum[i].r) * fft-&gt;numSamples;
          float im = scale(fft-&gt;spectrum[i].i) * fft-&gt;numSamples;
  
           if (i &gt; 0)
           spectrum[i] = sqrtf(re * re + im * im) / (fft-&gt;numSamples / 2);
           else
           spectrum[i] = sqrtf(re * re + im * im) / (fft-&gt;numSamples);
           AppLog("specturm %d",spectrum[i]); // everytime returns returns nan output
      }
  
  }
      KissFFTO* KissFFT::create(int numSamples) {
  
      KissFFTO* fft = new KissFFTO();
      fft-&gt;config = kiss_fftr_alloc(numSamples/2, 0, NULL, NULL);
      fft-&gt;spectrum = new kiss_fft_cpx[numSamples / 2 + 1];
      fft-&gt;numSamples = numSamples;
  
      return fft;
  }
  </code></pre>
  
  <p>scaling</p>
  
  <pre><code>    static inline float scale(kiss_fft_scalar val) {
      if (val &lt; 0)
          return val * (1 / 32768.0f);
      else
          return val * (1 / 32767.0f);
  }
  </code></pre>