From mboxrd@z Thu Jan 1 00:00:00 1970 Date: Fri, 16 Dec 2005 00:08:30 -0500 From: Dan Cross To: erik quanstrom , Fans of the OS Plan 9 from Bell Labs <9fans@cse.psu.edu> Subject: Re: [9fans] More Microsoft bashing Message-ID: <20051216050830.GE15067@augusta.math.psu.edu> References: <6e35c0620512152004n37c06ff5wd250424db50d874d@mail.gmail.com> <20051216045306.126521B12F3@dexter-peak.quanstro.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20051216045306.126521B12F3@dexter-peak.quanstro.net> User-Agent: Mutt/1.4.1i Cc: Topicbox-Message-UUID: c8f53ee8-ead0-11e9-9d60-3106f5b1d025 On Thu, Dec 15, 2005 at 10:53:06PM -0600, erik quanstrom wrote: > | Please note that this definition of DIV and MOD differs from the > | definition given in [M. Reiser, N. Wirth. Programming in Oberon. p. > | 36]: > | x = (x DIV y) * y + (x MOD y), and > | 0 <= (x MOD y) < y ^^^^^^^^^^^^^^^^^^ > | > | So, what *is* -5 MOD 3? > | > > -2 Are you sure? It looks to me more than it'd be +1. Wirth's definition above would tend to indicate that x MOD y is always positive, unless I'm reading it wrong, or that's not the whole story (and I confess I'm too lazy to look up the definitions in context). If I'm right, that would also imply that x DIV y tends more wards negative infinity than zero for negative numerators. - Dan C.