Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.1 6/24/83; site mmintl.UUCP Path: utzoo!watmath!clyde!burl!ulysses!bellcore!decvax!linus!philabs!pwa-b!mmintl!franka From: franka@mmintl.UUCP (Frank Adams) Newsgroups: net.lang.c Subject: Re: Architecture of Integer Remainder Message-ID: <1167@mmintl.UUCP> Date: Tue, 4-Mar-86 17:47:29 EST Article-I.D.: mmintl.1167 Posted: Tue Mar 4 17:47:29 1986 Date-Received: Sat, 8-Mar-86 21:03:02 EST References: <9341@ucla-cs.ARPA> Reply-To: franka@mmintl.UUCP (Frank Adams) Organization: Multimate International, E. Hartford, CT Lines: 31 In article <9341@ucla-cs.ARPA> jimc@ucla-cs.UUCP writes: > When a negative integer is divided, what should be the sign of the >remainder? > "C" users: Do we have a consensus that there should be a specific standard, >and that we want the remainder sign positive -- if the efficiency issue can >be resolved? Do users want a positive remainder even if it usually means >wasted code? How do users of other languages feel? If the efficiency issue could be resolved, this would be a good idea. Unfortunately, it cannot be. Some of the architectures in use now will still be in use 20 years from now. (Some of the architectures in use 20 years ago are still in use now.) This is too long a time frame to standardize in. > Compiler writers: Is it feasible to recognize when a dividend is in fact >always positive, so the extra code can be omitted? If you declare the >dividend explicitly unsigned, on some machines you must produce bizarrely >contorted code to handle the N'th bit; is it feasible to recognize when these >contortions are unnecessary? In a word, no. One can do this for some of the cases, but not in general. I suspect not even in a majority of the cases can this be done. I would recommend that C keep the / and % operators as they are now. One might add new operators which specify which result is wanted, but this is not the sort of thing the current ANSI committee should be looking at -- save the enhancements until we have a standard. Frank Adams ihnp4!philabs!pwa-b!mmintl!franka Multimate International 52 Oakland Ave North E. Hartford, CT 06108