a simple solution without casting to float or anything fancy: if you want to divide integers like this:
result=a/b
instead do this:
result=(a+b/2)/b
both divisions in this formula will round down, but that's ok - you will get mathematically correct result