Path: utzoo!utgpu!water!watmath!clyde!rutgers!sri-spam!ames!amdahl!nsc!taux01!amos From: amos@taux01.UUCP (Amos Shapir) Newsgroups: comp.lang.c Subject: Re: Simple question about: ~ Message-ID: <470@taux01.UUCP> Date: 29 Jan 88 09:41:52 GMT References: <1620006@hpcilzb.HP.COM> <2148@chinet.UUCP> Reply-To: amos%taux01@nsc.com (Amos Shapir) Organization: National Semiconductor (Israel) Ltd. Home of the 32532 Lines: 20 Hdate: 10 Shvat 5748 Since no one had mentioned this yet, I guess I'll have to: In article <2148@chinet.UUCP> dag@chinet.UUCP (Daniel A. Glasser) writes: >in two's complement arithmetic, the additive inverse (negative) of >a number is computed by taking the 1's complement (all 1's become 0's, >0's become 1's) of the bit pattern and adding 1. The definition of 2's complement is actually a little different: the binary represantation of a negative value is obtained by adding to it 2**n (** means power), where n is the number of bits, and doing a 'pure' unsigned binary represantation of the result. E.g. to represent -2 in a 16-bit word: -2 + 65536 = 65534 = 0b1111111111111110 -- Amos Shapir (My other cpu is a NS32532) National Semiconductor (Israel) 6 Maskit st. P.O.B. 3007, Herzlia 46104, Israel Tel. +972 52 522261 amos%taux01@nsc.com 34 48 E / 32 10 N