Suppose a system which supports only integer-division, and is bounded by the range $[0,M]$.
Given positive integers $x$, $n$, $d$ and $K$, let the following be:
- $y = \min(n,x)$
- $z = \max(n,x)$
- $p = \lfloor\frac{z}{K}\rfloor$
- $q = \lfloor\frac{d}{K}\rfloor$
I know that:
- $yp\leq M$
- $xn>M$ and therefore cannot be computed directly
How can I determine whether or not $\lfloor\frac{yp}{q}\rfloor\leq\lfloor\frac{xn}{d}\rfloor$?
Thank you!
Well in general, a floating-point division can be done with integer functions. Here is a numerical example:
125 / 13 = 9 <-
125 Mod 13 = 8
80 / 13 = 6 <-
80 Mod 13 = 2
20 / 13 = 1 <-
20 Mod 13 = 7
70 / 13 = 5 <-
for 9.615 as 9.62 .