This point is discusssed a few times in the old forum. Your analysis of the integer math etc is quite correct.
The formula used is derived from a floating point version which works great. Keeping the math in integer domain keeps it fast, but indeed with some quirks.
Rob