Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!watmath!clyde!burl!ulysses!bellcore!decvax!genrad!panda!talcott!harvard!seismo!mcvax!ukc!warwick!rlvd!asw From: asw@rlvd.UUCP (Antony Williams) Newsgroups: net.arch Subject: Re: Right shift vs. divide (change divide!) Message-ID: <1027@rlvd.UUCP> Date: Tue, 21-Jan-86 13:59:37 EST Article-I.D.: rlvd.1027 Posted: Tue Jan 21 13:59:37 1986 Date-Received: Sun, 26-Jan-86 05:15:20 EST References: <124000005@ima.UUCP> <4772@alice.UUCP> <1016@turtlevax.UUCP> <32@calgary.UUCP> Reply-To: asw@rlvd.UUCP (Antony Williams) Organization: Rutherford Appleton Laboratory, Atlas Buildings, U.K. Lines: 31 In article <32@calgary.UUCP> radford@calgary.UUCP (Radford Neal) writes: >Rather than get rid of the arithmetic right shift, one could instead >change the divide instruction so it does what mathematicians have >always thought division meant. this looks like opinion to me. > >Specifically: > > Quotient of -3 divided by 2 should be -2. > Remainder of -3 divided by 2 should be 1. > >With this definition, a right shift divides by two and masking off >the lower bit gives you the remainder. > >Does anyone know any reason, other than inertia, why divides shouldn't >be changed to work this way. Unfortunately, this breaks one of the equivalences that programmers tend to expect on intuitive grounds, namely: - ( a div b ) == ( -a div b ) == a div (-b) by analogy with real arithmetic. -- --------------------------------------------------------------------------- Tony Williams |Informatics Division UK JANET: asw@uk.ac.rl.vd |Rutherford Appleton Lab Usenet: {... | mcvax}!ukc!rlvd!asw |Chilton, Didcot ARPAnet: asw%rl.vd@ucl-cs.arpa |Oxon OX11 0QX, UK