1 and 2 complement systems

I am trying to understand the differences between the two systems and their impact on C programming.

From what I learned from Wikipedia:

  • both systems are used to represent negative numbers
  • one addition is applied bitwise NOT to a negative number (the system has +0 and -0)
  • two additions are performed, as in step 2, and adds 1 (excludes +/- 0)

Did I miss something else?

My questions:

  • What architectures support which system? What is the most common these days (1 or 2 supplements)?
  • In what sense should we consider these systems when programming in C? Does this basically make sense only in the embedded world?

Thanks in advance!

+3
source share
2 answers

, /, .

, - , , , -2 ^ 31 +2 ^ 31 - 1, . , - power-of-two ( , , , ).

+4

, - . , , , "-", . , , , blinkenlight -. , , ALU, , "" , , .

, , , , . , , , .

0

Source: https://habr.com/ru/post/1783546/


All Articles