Xref: utzoo comp.lang.c++:2149 comp.lang.c:14430 comp.lang.forth:693 comp.lang.fortran:1560 comp.lang.misc:2234 comp.arch:7395
Path: utzoo!utgpu!watmath!clyde!att!poseidon!ech
From: ech@poseidon.ATT.COM (Edward C Horvath)
Newsgroups: comp.lang.c++,comp.lang.c,comp.lang.forth,comp.lang.fortran,comp.lang.misc,comp.arch
Subject: Re: Assembly or ....
Message-ID: <606@poseidon.ATT.COM>
Date: 1 Dec 88 03:59:59 GMT
References: <949@taux01.UUCP>
Organization: AT&T Bell Laboratories, Lincroft, NJ
Lines: 28

In article <1032@l.cc.purdue.edu> cik@l.cc.purdue.edu (Herman Rubin) writes:
> suppose we want to
>divide a by b, obtaining an integer result i and a remainder c.  I know
>of no machine with this instruction,...

In article <8938@winchester.mips.COM> mash@mips.COM (John Mashey) writes:
> Although I don't necessarily subscribe to Herman's opinions, R2000 divides
> actually do this (leave both results in registers).  

From article <949@taux01.UUCP>, by cjosta@taux01.UUCP (Jonathan Sweedler):
> The 32000 series has a DEI (Divide Extended Integer) instruction that
> also does this. 

Hmm, add the MC68K, the PDP-11, and the IBM s/360 et fils.  Put another way,
does anyone have an example of a common processor that DOESN'T give you the
remainder and quotient at the same time?  I don't know the Intel chips, so
perhaps the original author just knows that the *86 divide doesn't do this.

It's interesting, though, how few languages provide such a "two-valued"
functions (all right, I can feel the mathematicians cringing.  So few
languages provide functions with ranges like ZxZ, OK?).  I've seen
implementations of FORTH, by the way, where the expression
	a b /%
for example, divides a by b, leaving a/b and a%b on the stack.  Of
course, if your favorite flavor of forth didn't provide the /% operator
("word") you'd just define it...

=Ned=