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 875 times
0
-
https://github.com/mgarcia01752/Q-Number-Format – Yuval Filmus Apr 27 '20 at 09:19
-
Well, what is the/your/0.0650's integral part? – greybeard Apr 27 '20 at 16:25
-
1https://cs.stackexchange.com/q/10318/755 – D.W. Apr 27 '20 at 19:12
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,419
- 2
- 28
- 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$.)