概念:

one’s complement ( 二进制补码的第一种形式)

two's complement(二进制补码的第二种形式  我们中文翻译中的“补码”)

 

 

 

 

Twos complement: Negative numbers in binary

 

二进制的负数表示法

负数的表示法:

(翻译)Twos complement: Negative numbers in binary

 

 

我们将第一位定义为符号位 ,1代表负数 0代表正数

 

(翻译)Twos complement: Negative numbers in binary

 

 

计算5+(-5) 结果是2

 

it doesn’t work,

 

 

下面我们来介绍 one’s complement

 

(翻译)Twos complement: Negative numbers in binary

 

 

在one’s complement中进行相加:

 

(翻译)Twos complement: Negative numbers in binary

 

 

结果都差了个1,

 

 

two’s complement

(翻译)Twos complement: Negative numbers in binary

 

 

 

(将 -0 去掉了)

 

 

 

相加的结果也是正确的

 

 

two’s complement中,位对应的值也是make sense的

 

-8 4 2 1

(翻译)Twos complement: Negative numbers in binary

 

 

计算方法也很简单,1.按位取反   2.加1

(翻译)Twos complement: Negative numbers in binary

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-06-19
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-07-05
猜你喜欢
  • 2021-11-11
  • 2021-04-22
  • 2022-12-23
  • 2021-12-01
  • 2022-02-15
  • 2022-12-23
相关资源
相似解决方案