Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/5/84; site ism780c.UUCP Path: utzoo!watmath!clyde!cbosgd!ukma!psuvm.bitnet!psuvax1!burdvax!sdcrdcf!ism780c!tim From: tim@ism780c.UUCP (Tim Smith) Newsgroups: net.arch Subject: Re: Integer division Message-ID: <548@ism780c.UUCP> Date: Mon, 10-Feb-86 15:57:07 EST Article-I.D.: ism780c.548 Posted: Mon Feb 10 15:57:07 1986 Date-Received: Wed, 12-Feb-86 20:36:55 EST References: <11610@ucbvax.BERKELEY.EDU> <5100003@ccvaxa> Reply-To: tim@ism780c.UUCP (Tim Smith) Organization: Interactive Systems Corp., Santa Monica, CA Lines: 20 In article <5100003@ccvaxa> aglew@ccvaxa.UUCP writes: > >The only architectural question here is - what should the >actual hardware support, if it has a MOD instruction? The architectural issue is how should division round. The behaviour of the MOD function is just a side effect of how division rounds. Thus, the architectural issue is which of the following is best: 1. round toward zero 2. round toward -infinity 3. round toward +infinity 4. round to closest integer ( have I left any out? ). 1 and 2 are the ones most people consider reasonable. With 2 we have arithmetic shift right and division by two are the same ( on a "normal" machine ), and a - (a/b)*b is the mod function. -- Tim Smith sdcrdcf!ism780c!tim || ima!ism780!tim || ihnp4!cithep!tim