I seem to recall once reading in one of the tAOCP fascicles Knuth's discussion of calculating the integer quotient and remainder. My memory is that he claims it is not possible to calculate one without the other, and that he believed the results should both be made available to the programmer. The problem being that most programming languages force the programmer to calculate something like q = a/b then r = a%b, but under the hood the CPUB did the same calculation twice, which is a waste.
I've just searched in MMIX Volume Fascicle 1 at the description of DIV in section 1.3.1, but I don't find the discussion I seem to recall.
Can someone tell me whether they recall a similar discussion, and where I might find it?
The following may be what you're looking for — it's the only relevant mention I found in all the volumes of TAOCP and (pre)fascicles released so far. (It's just a part of a sentence and not an elaborate discussion, but memory can be tricky.) From Volume 1 Fascicle 1, section 1.3′ (MMIX), specifically 1.3.1´ (Description of MMIX). As you know, under “Arithmetic Operations”, the
DIV
operation is defined such thatDIV $X,$Y,$Z
(if$Z
does not contain zero) sets$X
to contain the (floor) quotient of the values in$Y
and$Z
, and simultaneously sets therR
register to hold the remainder.Later, under “MMIX versus reality”, the second point is: