Path: ...!weretis.net!feeder8.news.weretis.net!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: David Brown Newsgroups: comp.lang.c Subject: Re: What is your opinion about unsigned int u = -2 ? Date: Thu, 8 Aug 2024 19:47:14 +0200 Organization: A noiseless patient Spider Lines: 18 Message-ID: References: <87bk2cecan.fsf@bsb.me.uk> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Injection-Date: Thu, 08 Aug 2024 19:47:15 +0200 (CEST) Injection-Info: dont-email.me; posting-host="ce5b9e6be3d3d9420cd4b6f4d8fd36d7"; logging-data="162858"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX194+ogtlAZKAGAHlDXcaX2eJ2ghtI4pq+Q=" User-Agent: Mozilla Thunderbird Cancel-Lock: sha1:/B+lMLLigs9d+tD5XfiHW5vuGRA= Content-Language: en-GB, nb-NO In-Reply-To: Bytes: 2083 On 08/08/2024 01:48, Lawrence D'Oliveiro wrote: > On Sun, 4 Aug 2024 20:29:21 +0200, Bonita Montero wrote: > >> Since the mid of the 70s all new machines work all with 2s complement. >> There will be never computers with different notations since the 2s >> complement makes the circuit design easier. > > This may be hard to believe, but I think in the early days 2s-complement > arithmetic was seen as something exotic, like advanced mathematics or > something. To some, sign-magnitude seemed more “intuitive”. > > As for ones-complement ... I don’t know to explain that. Think about negating a value. For two's complement, that means inverting each bit and then adding 1. For sign-magnitude, you invert the sign bit. For ones' complement, you invert each bit.