Path: utzoo!attcan!uunet!husc6!uwvax!tank!uxc!uxc.cso.uiuc.edu!uxg.cso.uiuc.edu!uxe.cso.uiuc.edu!mcdonald From: mcdonald@uxe.cso.uiuc.edu Newsgroups: comp.lang.c Subject: Re: DIV and MOD ( was: Something IBM di Message-ID: <225800089@uxe.cso.uiuc.edu> Date: 8 Nov 88 21:48:00 GMT References: <972@goofy.megatest.UUCP> Lines: 17 Nf-ID: #R:goofy.megatest.UUCP:972:uxe.cso.uiuc.edu:225800089:000:515 Nf-From: uxe.cso.uiuc.edu!mcdonald Nov 8 15:48:00 1988 > -1 >> 1 giving -1 Odd. Lets see here. In binary 4 bits 1 == 0001b 0 == 0000b -1 == 1110b with zero filling shift -1 >> 1 == 0111b == 7 with sign filling shift -1 >> 1 == 1111b == -0 neither of which are == -1. Perhaps you are unfamiliar with this relatively common method. On some machines -1 >> 1 == -1, but not all machines - and not necessarily in ANSI C. :-) :-) :-)