COP-Digit

concept

  • 计算机数据表示:在计算机当中,能够被硬件直接识别和处理的数据类型(对该数据类型的指令直接包含在计算机的指令集当中)
    COP-Digit_chapter6.1_190422

6.1 无符号数和有符号数

1.无符号数

  • the digits of register reflects the range of representation of unsigned Numbers
    (寄存器的位数反映无符号数的表示范围)
    COP-Digit_chapter6.1_190422
00000000 11111111
0 255(28-1)
28=256 216=65536

2.有符号数

机器数与真值

  • 机器数 : 保存在计算机中的数(符号数字化0/1)
  • 真值 : 被保存数据的真实值(带符号)
  • 小数点没有专门的硬件表示,一般以约定方式给出
    COP-Digit_chapter6.1_190422

原码表示法

  1. 定义:
    n : 数值部分位数
    COP-Digit_chapter6.1_190422COP-Digit_chapter6.1_190422

    especially
    COP-Digit_chapter6.1_190422

  2. features
    简单,直观

  3. shortcomings : 既有加法操作也有减法操作,较为复杂,对硬件要求过高
    COP-Digit_chapter6.1_190422


补码表示法

  • conceptCOP-Digit_chapter6.1_190422COP-Digit_chapter6.1_190422
  • 性质
  1. 正数的补数即为其本身
    COP-Digit_chapter6.1_190422对正数:
1 0 0 0 0 0
+ 1 0 1 1
1(舍弃) 0 1 0 1 1

101011–>五位寄存器(最高位舍弃)
0,1011

conclusion:
补码定义及计算

COP-Digit_chapter6.1_190422
COP-Digit_chapter6.1_190422
practice
COP-Digit_chapter6.1_190422


反码表示法
COP-Digit_chapter6.1_190422
COP-Digit_chapter6.1_190422
practice
COP-Digit_chapter6.1_190422


conclusion

  • 对真值0表示形式唯一的机器数是补码[正零负零的补码表示且只有补码表示相同]
    COP-Digit_chapter6.1_190422

  • 机器数的表示范围与字长的关系
    COP-Digit_chapter6.1_190422

  • 已知 [y]补 求 [-y]补
    对[y]补分情况讨论(符号位为0/1)
    COP-Digit_chapter6.1_190422
    COP-Digit_chapter6.1_190422
    COP-Digit_chapter6.1_190422


移码表示法
COP-Digit_chapter6.1_190422
COP-Digit_chapter6.1_190422

  • notice : 仅有整数移码表示而小数定义与移码在计算机数据表示的作用有关–>浮点数据表示中的阶码表示(阶码均为整数)

COP-Digit_chapter6.1_190422
COP-Digit_chapter6.1_190422

  • 真值位数为5–>移码偏移量 25= 32
  • 补码/移码 对0有唯一表示形式
  • 对最小数 -32(- 25)
    移码 : x + 25 = -32+32 = 0
    COP-Digit_chapter6.1_190422

另:简便操作 除符号位 以外全部取反再+1 即为 二进制中 2n- x 的快速运算方式
参考 : 若2n + x 即 符号位 处+1 符号位权重为[2n]
eg:
1 0 0 0 0 0 0 0
- 1 1 0 0 1 0 0

1 1
1

先将2n 拆为 ∑2n-1+1

0 1 1 1 1 1 1 1 + 1
- 1 1 0 0 1 0 0
= 0 0 1 1 0 1 1 (相当于先取反) 再将拆出的1加回 --> 利用了非0即1的性质

相关文章:

  • 2022-01-01
  • 2022-12-23
  • 2021-12-02
  • 2021-07-18
  • 2021-11-27
  • 2021-11-27
  • 2021-11-27
猜你喜欢
  • 2021-07-21
  • 2021-05-16
  • 2022-12-23
  • 2021-09-26
  • 2022-01-01
  • 2022-12-23
  • 2021-12-07
相关资源
相似解决方案