The other possibility is to multiply first, and then divide. Ensure that you do not get any overflows doing this. Check the formula against extreme values that would create the largest number after the multiply, and see if it still fits within the maximum size of the integer type you are using. This way, you needn't use floating point numbers at all.