How would you convert decimal 0.0650 to 1.15 Q format 16-bit of course? I'm kinda stuck in this for 3 days, can someone kindly help me out in this
Asked
Active
Viewed 1,387 times
2 Answers
0
Convert $0.065$ in binary with 15 digits of precision in the fractional part (rounding to the nearest such number):
$$ (0.065)_{10} \approx ( 0.000100001010010)_2$$
Multiply $(0.000100001010010)_2$ by $(2^{15})_{10}$ (i.e., remove the fractional-part separator) to obtain $(0000100001010010)_2$.
If you want it in hexadecimal, as you have asked in another question, you can convert it:
$$ (0000100001010010)_2 = (0852)_{16} $$.
Steven
- 29,724
- 2
- 29
- 49
0
If you multiply the Q1.15 format by $2^{15}$ you get a Q16.0, i.e. an integer.
Evaluate $$0.0650\times 2^{15}=2129.92$$ which you round to $2130=100001010010_b$.
Now you revert to Q1.15 by padding to get $15$ bits after the point:
$$0.000100001010010_b$$
(this is exactly $0.06500244140625$.)