1

Using integer arithmetic, it is true that:

$$ (\frac{x}{y})\div z = (\frac{x}{z})\div y = \frac {x}{(y \times z)} $$

Intermediate results must be integers also (so this practically relates to computation with integer values).

Rounding is by truncation of the remainder (that is, towards zero).

If it is not always true, what are the general cases when it fails?

Does this derive from some law of number theory?

rghome
  • 227
  • 2
    What rules of rounding are you using? (Including for negative numbers.) – Hans Lundmark Jun 27 '18 at 12:24
  • Truncation of the remainder. So positive integers go down and negative integers go up (i.e, both towards zero). – rghome Jun 27 '18 at 12:28
  • 1
    See this answer for the case of $x\div y=\lfloor x/y\rfloor$. – Christoph Jun 27 '18 at 12:35
  • @Christoph - I think the question covers (x÷y)÷z=x÷(y×z), but since multiplication is commutative then it would also cover my other case as well. – rghome Jun 27 '18 at 12:41
  • That is correct. Furthermore you should be able to apply this to your rounding definition (which is $x\div y = \operatorname{sign}(xy) \lfloor |x|/|y|\rfloor$ by treating signs separately. (Note that the linked answer assumes $c>0$) – Christoph Jun 27 '18 at 12:43

0 Answers0