补码二进制加法

Two's Complement binary addition

我有一个程序可以将 2 个二进制补码相加并输出输出。它们作为二进制补码中的第一个二进制数从文件中读取。第二个二进制数是有偏见的。要改变偏向二进制补码的形式,我们翻转最左边的位。然后我们将两个二进制数相加并将输出提供给文件。我遇到的问题是理解输出。这是输出,其中第一个二进制数是二进制补码,第二个二进制数是有偏符号。

   01000000 <- 2's complement         64
+  11000000 <- biased notation        64
-----------------------------------------------
   10000000 <- 2's complement   Overflow

   01111111 <- 2's complement        127
+  00000000 <- biased notation      -128
-----------------------------------------------
   11111111 <- 2's complement         -1

   00000011 <- 2's complement          3
+  10000111 <- biased notation         7
-----------------------------------------------
   00000110 <- 2's complement          6

   00001111 <- 2's complement         15
+  10000111 <- biased notation         7
-----------------------------------------------
   00010010 <- 2's complement         18

   10000000 <- 2's complement       -128
+  11111111 <- biased notation       127
-----------------------------------------------
   11111111 <- 2's complement         -1

   11110000 <- 2's complement        -16
+  10001000 <- biased notation         8
-----------------------------------------------
   11111000 <- 2's complement         -8

   10000001 <- 2's complement       -127
+  00000001 <- biased notation      -127
-----------------------------------------------
   00000010 <- 2's complement   Underflow

   01111111 <- 2's complement        127
+  00000000 <- biased notation      -128
-----------------------------------------------
   11111111 <- 2's complement         -1

   01110101 <- 2's complement        117
+  11010001 <- biased notation        81
-----------------------------------------------
   01000110 <- 2's complement         70

   00000000 <- 2's complement          0
+  10000000 <- biased notation         0
-----------------------------------------------
   00000000 <- 2's complement          0

   00001111 <- 2's complement         15
+  11110000 <- biased notation       112
-----------------------------------------------
   01111111 <- 2's complement        127

   00001111 <- 2's complement         15
+  10000001 <- biased notation         1
-----------------------------------------------
   00010000 <- 2's complement         16

   00000111 <- 2's complement          7
+  11110000 <- biased notation       112
-----------------------------------------------
   01110111 <- 2's complement        119

   11111111 <- 2's complement         -1
+  01111111 <- biased notation        -1
-----------------------------------------------
   10101010 <- 2's complement        -86

   00000000 <- 2's complement          0
+  10000000 <- biased notation         0
-----------------------------------------------
   00000000 <- 2's complement          0

   11111111 <- 2's complement         -1
+  11111111 <- biased notation       127
-----------------------------------------------
   00101010 <- 2's complement         42

鉴于第三个例子说 3 + 7 = 6。 这甚至是正确的吗?好像不对,但是其他的例子都是对的。比如 -16 + 8 = -8。

所以我的问题是...这个文件的输出是否正确?

似乎每当你连续有 3 个进位时,它就会掉 1。与下一个相同,15 + 7。它没有正确进行进位。

  11  <- carry
 0011 = 3
+0111 = 7
 1010 = 10