Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.3 4.3bsd-beta 6/6/85; site ucbvax.BERKELEY.EDU Path: utzoo!watmath!clyde!burl!ulysses!ucbvax!brahms!weemba From: weemba@brahms.BERKELEY.EDU (Matthew P. Wiener) Newsgroups: net.lang,net.lang.c Subject: Re: Integer division Message-ID: <11921@ucbvax.BERKELEY.EDU> Date: Wed, 19-Feb-86 04:26:34 EST Article-I.D.: ucbvax.11921 Posted: Wed Feb 19 04:26:34 1986 Date-Received: Fri, 21-Feb-86 04:14:22 EST References: <11603@ucbvax.BERKELEY.EDU> <4917@alice.UUCP> Sender: usenet@ucbvax.BERKELEY.EDU Reply-To: weemba@brahms.UUCP (Matthew P. Wiener) Followup-To: net.lang Organization: University of California, Berkeley Lines: 30 Xref: watmath net.lang:2122 net.lang.c:7911 In article <736@abic.UUCP> jst@abic.UUCP (Shack Toms) writes: >> In article <731@abic.UUCP> jst@abic.UUCP (Shack Toms) writes: >> >However: One might use a%b<0 iff a<0 in an algorithm which printed >> >the value of an integer in a given radix. The least significant >> >digit of a in radix b would then be |a%b|. :-) >> >> So would |a|%b, and it works under either convention. :-) > >Except that |a| is not available for the full range of a. In >particular, on a 16 bit computer |-32768| is not expressible. I don't know about you, but I'm too paranoid about the least negative number to begin with. In fact, I try not to get close, if possible. Frankly, if it's a question of a language getting integer division done correctly on -32767 to 32767 or getting it done incorrectly on -32768 to 32767, I think there is no debate about which is preferable. Or, to express my point in less prejudicial terms: in arguing A vs B in a language, the question of what happens with the least negative number is almost always irrelevant. >The real point [of the :-)] etc. Agreed etc. Personal to Shack Toms- I got mail asking me to keep this issue off of net.arch. As you reposted to net.arch, I wonder if you did? As it is, I'm sending this up to net.lang, since it is not really a C specific question. ucbvax!brahms!weemba Matthew P Wiener/UCB Math Dept/Berkeley CA 94720