note
BrowserUk
<blockquote><i>you could do it with side effects on the arguments. </i></blockquote>
<p>That kind of defeats the original purpose of utilising the fact that -- for every processor I'm knowledgeable of; though that's not a huge sample -- at the machine code level, DIV instructions produce both quotient and remainder as the result of a single operation.
<P>From the Intel manual:
<blockquote><i>
<p>DIV—Unsigned Divide
<p>Description: Divides unsigned the value in the AX, DX:AX, EDX:EAX, or RDX:RAX registers (divi-
dend) by the source operand (divisor) and stores the result in the AX (AH:AL),
DX:AX, EDX:EAX, or RDX:RAX registers.
</i></blockquote>
<p>The two operations of finding quotient and remainder of one number divided by another are so often used in concert with each other, it seems a waste to have to perform the division twice to get at both parts.
<blockquote><i>(Just for the fun of it in autoboxing notation...)</i></blockquote>
<P>Yuck! What a waste of cpu :)
<div class="pmsig"><div class="pmsig-171588">
<hr />
<font size=1 >
<div>With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'</div>
<div>Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.</div>
<div>"Science is about questioning the status quo. Questioning authority". </div>
<div>In the absence of evidence, opinion is indistinguishable from prejudice.
</div>
</font>
</div></div>
180320
1070185