Newsgroups: rec.arts.int-fiction
Path: nntp.gmd.de!news.ruhr-uni-bochum.de!news.rhrz.uni-bonn.de!RRZ.Uni-Koeln.DE!news.duesseldorf.ecrc.net!news.ecrc.de!02-newsfeed.univie.ac.at!01-newsfeed.univie.ac.at!swidir.switch.ch!in2p3.fr!univ-lyon1.fr!howland.erols.net!netcom.com!erkyrath
From: erkyrath@netcom.com (Andrew Plotkin)
Subject: Re: [Z-machine] Divison and modulo
Message-ID: <erkyrathDyEEsy.C1t@netcom.com>
Organization: NETCOM On-line Communication Services (408 261-4700 guest)
X-Newsreader: TIN [version 1.2 PL1]
References: <Pine.LNX.3.95.960920173018.5222G-100000@adamant.res.wpi.edu> <wwaenjot1uk.fsf@bommel.math.ruu.nl>
Date: Fri, 27 Sep 1996 15:53:21 GMT
Lines: 42
Sender: erkyrath@netcom.netcom.com

Bruce Stephens (stephens@math.ruu.nl) wrote:
> >>>>> "Andrew" == Andrew Plotkin <erkyrath@netcom.com> writes:

> > Your position is consistent, but in fact all C and C++ compilers
> > that I've tested don't do it that way. It seems best to have the
> > @MOD opcode (which is generated by Inform's % operator) work like
> > the more common C % operator.

> That's probably because they simply use the machine instructions.

Yes, certainly.

>  In
> any case, I think the Z machine should provide whatever is most useful
> for writing IF programming, and secondarily whatever makes most sense
> in some theoretical way (I'm sure Graham, Knuth and Patashnik
> ("Concrete Mathematics") define what mod *ought* to give, but I don't
> remember the definition.  Compatibility with C comes way down my list,
> although compatibility for the most common case (A%B with A and B both
> non-negative, and B non-zero) is important; for other cases I'd have
> to look at the documentation anyway.

Ah, but my position is that *the Inform development system* should 
provide whatever is most useful for IF programming. Arithmetic modulo can 
be provided by the compiler or the standard libraries, even if it doesn't 
exist at the Z-machine level.

In this case, we have a de-facto standard (Infocom's interpreters) which
cannot be changed, and which moreover is similar to existing (non-virtual)
machine architectures. We also have a game (Lurking Horror) which assumes
that standard, and cannot be changed either. We also have a language
(Inform) whose expression syntax is based on C, which uses that standard,
and although Inform can be changed, I'm not volunteering to convince
Graham that it ought to be. 

So the hell with it. :)

--Z
-- 

"And Aholibamah bare Jeush, and Jaalam, and Korah: these were the
borogoves..."
