* Use two periods of the sine for testing instead of one and scale the values
authorunknown <s0042331@.dynamic.ewi.utwente.nl>
Thu, 27 Mar 2008 16:41:25 +0000 (17:41 +0100)
committerunknown <s0042331@.dynamic.ewi.utwente.nl>
Thu, 27 Mar 2008 16:41:25 +0000 (17:41 +0100)
   to prevent overflow.

FFT_support.cpp

index 23d07f08ca102e114e7428807701f364fcdcc566..d3b5d09d28cc0917cd68106f5db53c7b7a53d916 100644 (file)
@@ -68,7 +68,9 @@ void pre_run()
        \r
        for (i=0;i<PARAM_N_t;i++)\r
        {\r
-               int value = to_fixed(sin((float)i*2*M_PI/PARAM_N_t));\r
+               /* We take the sine from 0 to 2*2*Pi, ie two periods. We divide \r
+                * the value by PARAM_N_t to prevent overflow. */\r
+               int value = to_fixed(sin((float)i*2*2*M_PI/PARAM_N_t)/PARAM_N_t);\r
 \r
                if (i<PARAM_N_t/2)\r
                {\r