@neil: I am using Ride7 and working on STM32F103ZE. Do you know how to add that floating library file in it?? is it available for this controller?. Thanks a lot for help.
a library - it is just a header file! In addition to #include-ing math.h, you will also have to add the appropriate floating-point lirary/libraries to your project. For details, see the documentation for your particular toolset. Note that some free/restricted toolset versions may not allow use of floating point
Integer vs. floating point makes a BIG difference in execution time. My DTMF decode went from 10 milliseconds to 0.6 milliseconds.
This was for a 100 sample Goertzel algorithm performing sums and power calculation using integer arithmetic returning a signed 64-bit integer. I used 16 different frequencies -- the basic 8(*) and their second harmonics. C code converted that to 32-bit fp. Column/row selection used fp to pick a winner that had to be 3x the sum of the other three items. Sum of all 8 harmonics had to be a factor of 3 or 4 less than the winning row value. (*) that included the almost never present ABCD column to the right of 369#.
Note that floating-point has a very significantly greater overhead (both code size and execution time) than integer maths - therefore you should think very carefully indeed whether you really need floating point in your application.
This is one reason why many (most?) embedded toolchains do not include floating-point by default. In most cases, it is easy enough to scale you values so that you can do everything in integer maths; eg, instead of processing 3.3V as a floating-point number, think of it as 3300mV - an integer! You can choose any scaling factor that is convenient to your particular application. Functions such as tan() can be implemented as lookup tables, or integer implementations - so-called ''fixed point'' - are available. eg, CORDIC algorithms:
So, try it first using floating-point; but be aware that this may give you code-size and/or performance issues - so be prepared to explore the alternatives...