Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: Notesfiles $Revision: 1.7.0.10 $; site convexs Path: utzoo!watmath!clyde!burl!ulysses!mhuxr!mhuxt!houxm!ihnp4!inuxc!pur-ee!uiucdcs!convex!convexs!wallach From: wallach@convexs.UUCP Newsgroups: net.arch Subject: Re: Right shift vs. divide Message-ID: <3000002@convexs> Date: Tue, 7-Jan-86 10:27:00 EST Article-I.D.: convexs.3000002 Posted: Tue Jan 7 10:27:00 1986 Date-Received: Thu, 9-Jan-86 02:46:57 EST References: <4772@alice.UUCP> Lines: 17 Nf-ID: #R:alice.UUCP:4772:convexs:3000002:000:581 Nf-From: convexs.UUCP!wallach Jan 7 09:27:00 1986 arithmetic right shifting is equivalent(numerically) to division if the algorithm is implemented correctly. just because most machines do it wrong doesn't mean it doesn't work. the correct algorithm for right shifting for fixed point is: 1)if the operand is positive right shift. 2)if the operand is negative, negate the operand before shifting, then right shift, and then negate the result. if you want, try the infamous right shift all 1's (-1). the division is round toward zero (ala fortran). the MV series from data general perform arithmetic right shifting correctly