Doh! of course, do the calculations at increased values to hide the fractions and then divide them again to bring back to a normal range. I used to do this in asm to fake floating points.
In case anyone is reading this and doesn't know what I'm waffling on about, I'll try to explain.
In this case, I want to multiply a whole number with a number that has decimal places, 389 x 0.5 for example.
Normally, we would take a calculator and type the numbers in, but what if the calculator didn't have a decimal point? We couldn't do the calculation as it stands.
So what we can do is multiply the 0.5 by a whole number to make it a whole number (please don't get pedantic and wonder why the calculator can suddenly do this multiplication, I've just woken up and analogies are tricky at the moment).
Computers really like numbers that are factors of 2, so let's multiply the number by 256. This means that our calculation is now:
389 x (0.5 x 256) or 389 x 128
Much easier, we just have to remember to divide the final result by 256 at the end, to bring the total back into our expected range. Also, there is a nice trick we can do to divide a whole number by a factor of 2. We simply shift the BITs to the right as many times as we need.
If we were to double a number, we could shift the BITs left by one, to halve it, we shift right by one.
Shifting left by two places would be x4, right by two would be /4
Shifting left by three places would be x8, right by three would be /8
and so on
Shifting left by eight places would be x256, right by eight places would be /256
It's a really useful and fast method of multiplication as the computer doesn't actually do any multiplication, it just moves BITs around.