DSPRelated.com
Forums

Fixed point math

Started by Praetorian October 11, 2005
Hi, could anyone tell me if there is a library that I could download to
do 16-bit fixed point math? I intend to use it on the TI2407, TI has
the IQMath library for 32-bit fixed point but I can't find anything for
16-bit. 

Thanks for your help,
Ashish.

Praetorian wrote:
> Hi, could anyone tell me if there is a library that I could download to > do 16-bit fixed point math? I intend to use it on the TI2407, TI has > the IQMath library for 32-bit fixed point but I can't find anything for > 16-bit. > > Thanks for your help, > Ashish.
Have you looked to see if the C compiler has any non-ANSI intrinsic math functions? For example, on the '54X, there are lots of them, like _sadd(x,y) to add two 16 bit numbers x and y with saturation. John
There is no library that I know of, so you must do whol Q-math
yourself.
You should take a look at Randy Yates's paper on fixed point
arithmetics
home.earthlink.net/~yatescr/fp.pdf


also this might help
fixed point multiply

signed
  int m1,m2,result;
  result = ((long) m1 * (long) m2) >> 16;

unsigned

  unsigned m1,m2,result
  result = ((unsigned long) m1 * (unsigned long) m2) >> 16;

Regards,

Mitja

Korenje wrote:
> There is no library that I know of, so you must do whol Q-math > yourself. > You should take a look at Randy Yates's paper on fixed point > arithmetics > home.earthlink.net/~yatescr/fp.pdf > > > also this might help > fixed point multiply > > signed > int m1,m2,result; > result = ((long) m1 * (long) m2) >> 16; > > unsigned > > unsigned m1,m2,result > result = ((unsigned long) m1 * (unsigned long) m2) >> 16;
The needed amount of shift depends on the location of the radix point. Jerry -- Engineering is the art of making what you want from things you can get. �����������������������������������������������������������������������