algorithm for Q12 format

Status
Not open for further replies.

rmreddy

Member level 3
Joined
Feb 20, 2007
Messages
65
Helped
2
Reputation
4
Reaction score
1
Trophy points
1,288
Activity points
1,718
q12 format

hi all,
can anyone share the material or algorithm for converting a flaoting point value in C to a fixed point Q12 - format, as we do in a DSP processor.

i want to know the logic behind how it works ....
 

q12 fixed point

Q12 format for fixed-point numbers means 12 fractional bits 3 integer bits and 1 sign bit. Say you have number x as floating-point (within +_1.0 range), xq12 is given as;

xq12 = round(x*2^12);

I hope it helps.
 

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…