From mboxrd@z Thu Jan 1 00:00:00 1970 To: Fans of the OS Plan 9 from Bell Labs <9fans@cse.psu.edu> From: "Brian L. Stuart" Subject: Re: [9fans] More Microsoft bashing In-reply-to: Your message of Fri, 16 Dec 2005 00:08:30 -0500 . <20051216050830.GE15067@augusta.math.psu.edu> Date: Thu, 15 Dec 2005 23:19:35 -0600 Message-Id: <20051216052053.VFSC12897.ibm69aec.bellsouth.net@p1.stuart.org> Topicbox-Message-UUID: c8f996be-ead0-11e9-9d60-3106f5b1d025 In message <20051216050830.GE15067@augusta.math.psu.edu>, Dan Cross writes: >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 This also matches Knuth's in Vol 1. He states it as: x mod y = x - y * floor( x / y ) and then observes that the mod follows the sign of y and that the magnitude of the mod is strictly less than that of y. Brian L. Stuart