Q=A/B , Q is a real number expressed as a pair of 8 bits:
- most significant 8 bits for the integer part
- least significant 8 bits for the fractional part
- the number is unsigned
for example:
0 0 1 0 1 1 0 1 . 0 1 0 1 0 0 0 0
Can you find the remainder of division if you know B?
example: 44/20
0010 1100 . 0000 0000 / 0001 0100 . 0000 0000
= 0000 0010 . 0011 0011 (2.1999...)
Now, to find the reminder I should multiply(0.19... * 20) 0000 0000 . 0011 0011 * 0001 0100 . 0000 0000
= 0000 0011 . 1111 1100
Now, can I say that the number is 4 because is greater than 3.5? I don't think this works for all the numers
There are exceptions, for example A=2 and B=172, I wonder if increasing the fractional part bits number solves the problem
2/172 :
0000 0010 . 0000 0000 /
1010 1100 . 0000 0000
=0000 0000 . 0001 0010
0000 0000 . 0001 0010 *
1010 1100 . 0000 0000
=0000 0000 . 1100 0001 (should be 2, or at least something greater than 1.5)