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.

IQmath missing function definitions



moderator: please move this post to the correct forum

webmaster: PLEASE re-work this web site so that the complete list of forums can found from the top

 

we've been using the IQmath libraries and been taking advantage of the MATH_TYPE flag when compiling for the host and have noticed

some of the IQ function are missing for MATH_TYPE=1, (FLOAT_MATH)

they are trivial additions, but it would be nice if these got rolled back in to the next release.

thanks

in IQmath.h:

...

#else // MATH_TYPE == FLOAT_MATH

...

typedef float _iq0;

...

#define _IQ0(A)   (A)

...

#define _IQ0toF(A)  (A)

...

#define _IQNtoF(A,N)  (A)

#define _FtoIQN(A,N)  (A)

#define _IQXtoIQY(A,X,Y)  (A)

#define _IQrsmpy(A,B,N)  ((A)*(B))

#define _IQNmpyIQx(A,X,B,Y,N) ((A)*(B))

#define _IQNmpy(A,B,N) ((A)*(B))

#define _IQdiv(A,B,N) ((A)/(B))

#define _IQNabs(A)  fabsf(A)

#define _IQNsqrt(A,N)  sqrtf(A)

#define _IQNcos(A,N)  cosf(A)

#define _IQNsin(A,N)  sinf(A)

#define _IQNmag(A,B,N) sqrtf((A)*(A)+(B)*(B))

#define _IQNint(A,N) ((int)(A))

#define _IQNlog(A,N)  logf(A)

 

there may still be other missing float functions, but those are the ones we used and found missing.

 

we also added a

#define _IQN(A,N) (A)

but that wasn't defined for MATH_TYPE=IQ_MATH

so also added:

#extern const I32_IQ IQuintTable[];

#define _IQN(A,N)   ((I32_IQ) (A) * IQuintTable[(N)]))

with the appropriate addition of the IQuintTable[] in IQmathtables.c

unfortunately, that becomes a run-time multiply, but the code is way more maintainable to be able to use a #define for the radix