((a<<16)/b)
will give you the 16-bit fractional portion of the division.
It's easier to see in base-10: If we want to find the first three fractional-digits of, say, 5/3, we can move 5 three places over (5000), divide that by 3, then take the last three whole digits. 5000/3 is 1666, so the first three digits after the decimal of 5/3 are .666.
This works because "moving 5 one digit over" is the same as "multiplying by 10", and multiplication/division are commutative (the order can be swapped around), so (5 * 1000) / 3
= (5 / 3) * 1000
= 1.6666... * 1000
= 1666.666...
.
In other words, shifting 5 over a few digits and dividing by 3 is the same as shifting (5/3) by a couple of digits.