Should i use IQ math library in floating point controller?....any benefit for using that lib.
This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
Should i use IQ math library in floating point controller?....any benefit for using that lib.
Hi!
Difficult to say. I recommend floating point for all kinds of signal processing. That's easy to use, you do not need to count bits and care about minimum and maximum values. But with integer arithmetic you get higher resolution. Single precision floating point offers 23 bit relative precision (approx 7 decimal places), long ints offer 32 bit absolute precision (approx 10 decimal places).
In my projects I do not use IQmath since Delfinos and Piccolos have floating point units. But I still need large integer values (i.e. for integration). And in these cases I simply use long long. With 64 bit you will have enough headroom to sum up 32 bit values :-).
Best regards,
Edwin Krasser
Hi,
Here is an example for operations in single-precision-floating-point. ( from TI's doc 'C28x IQ – Math Library')

Regards,
Frank
Hello!
Of course, everybody should know, what he is doing with floating point or integer arithmetic. Hence, I wrote that floating point is very useful for signal processing, but not for summing up (i.e. never do FIR moving average filtering in floating point IIR implementation!).
So: Who will implement loops with floating point variables? And who does not prefer floating point for signal processing (dynamic signals with resolutions far below the mantissa resolution, IIR filtering, ...)? But: Everybody just keep in mind what he is doing, and what the numbers are doing. Then these classical academic examples will remain academic.
Best regards,
Edwin Krasser
In the IQ library, there is a function called _IQmag(a,b) which is equivalent to sqrt(a^2 + b^2). What I am trying to do is sqrt (a^2 - b^2) in my code. Currently I am trying to manually do it by using _IQexp(A) and _IQsqrt(A) but I seem to run into overflow problems (most likely within the _IQexp(A) function). My global _IQ = 24. Does anyone have a suggestion on how to successfully achieve this?
Hi Kelly- You could try _IQsqrt(_IQmpy((A+B),(A-B))). A+B might cause overflow so you will have to be careful there.If it does and both numbers are not too far on the number scale you could work with normalized numbers?
_IQexp(A) is e^A Im guessing you were going for ^2 function or did i misunderstand your post completely?