补码: -1 ≤ N ≤ 1-2-n 定点整数:
原码: -(2n -1) ≤ N ≤ 2n -1 反码: -(2n -1) ≤ N ≤ 2n -1 补码: - 2n ≤ N ≤ 2n -1
· 定点数运算中,结果超出了计算机能表示的范围后,会发生溢出,基本原因是因为计算机字长的限制。溢出分为两种,一种是正溢出,一种是负溢出;正溢出是指结果超过了计算机所能表示的最大值,负溢出是指结果小于计算机所能表示的最小值。
· 溢出判断方法有三种,这里只介绍常用的两种(1)符号运算进位标志Cf和最高有效位进位标志C进行异或运算,结果为1则发生了溢出,结果为0则结果正确;(2)使用双符号位,首先把参与运算的数改写成双符号位,即把已有的符号位上的数字再多写一遍,如“1.1100”改写为“11.1100”,然后进行预算,符号位结果为“01”时,表明发生了正溢出;符号位结果为“10”时,表示发生了负溢出。符号位结果为“00”或“11”时表示结果正确。
· 定点数二进制运算器中,减法是通过进行补码的加法来实现的。
· 用二进制编码十进制数得到的码叫做BCD码(Binary-Code Decimal),8421码是其一种,用0000,??,1001表示0-9。使用8421码做加法时,若和大于9则结果需要加6进行修正,小于则不需要修正。
· 计算机中使用无符号整数来表示地址。
第二章测验
If [X] 2‘s complement = 0.1101010,then [X]sign-magnitude = ( D )
A.0.0010110 B.1.0010110 C.1.0010101 D.0.1101010
观察符号位为0,说明此数为正数,正数的补码表示和源码表示是一样的,因此选D。
2. ( B ) is used to represent address in computer.
1‘s complement Unsigned number 2‘s complement Sign magnitude
计算机中地址使用无符号数表示。
3. Numbers X1, X2 are integer, and 【X1】2‘s compl = 10011011,【X2】 2‘s compl = 00011011, then their true value of decimal form are -101 and 27 . 基本运算,注意观察数字的正负,不可一律按位取反末位加一,正数的补码就是其本身
4. The sign-magnitude representation of ?0‘ is unique. ( B )
9
True False
源码对“0”的表示并不唯一,有“+0”与“-0”之分。
5. Plus two 2‘s complement numbers that adopt 1 sign bit, overflow must occur when ( C/D ).
carry signal is generated from the sign bit
XOR operation for carry signal generated from the sign bit and carry signal generated from the highest numerical bit is ?0‘.
XOR operation for carry signal generated from the sign bit and carry signal generated from the highest numerical bit is ?1‘.
XOR operation for carry signal generated from the sign bit and carry signal generated from the highest numerical bit is ?1‘.
将两个采用单符号位的补码表示的数相加,( C/D )时一定会溢出。
从符号位上产生了进位信号
对从符号位上产生的进位信号和从最高数位上产生的进位信号进行异或操作,结果为0 对从符号位上产生的进位信号和从最高数位上产生的进位信号进行异或操作,结果为1 对从符号位上产生的进位信号和从最高数位上产生的进位信号进行异或操作,结果为1
//C,D答案一样,选哪个都行。
6. The range of representation for a 1‘s complement number system of 64 bits (including the sign bit) is ( A ).
0≤|N|≤263 – 1 0≤|N|≤262 – 1 0≤|N|≤264 – 1 0≤|N|≤263
除去符号位后,剩余63位可以用来表示数字,根据反码的表示范围1–2n≤ N ≤2n – 1得出答案
7. Fixed point number can be classified into pure decimal(纯小数) and pure integer(纯整数).( A ) True False
8. In fixed point calculator, whether adopted double sign bit or single sign bit, it must has ( C ), which is often implemented by ( C ).
Decoding circuit, NAND gate encoding circuit, NOR gate
overflow detection circuit, XOR gate
10
shift circuit, AND-OR gate
在定点数计算中,是否采取双符号位还是单符号位,它都必须有( C ),它经常使用( C )来实现
解码电路,与非门 译码电路,或非门 溢出检测电路,异或门 移位电路,与或门
一般来说,使用检测符号进位信号和最高数位进位信号的异或结果来进行溢出判断,因此需要异或门。
9. Arithmetic shift 2‘s complement of a positive, sign bit remains unchanged, and the blank bit fills in ?0‘. Arithmetic left shift 2‘s complement of a negative, sign bit remains unchanged, and the low bit fills 0 . Arithmetic right shift 2‘s complement of a negative, sign bit remains unchanged, and the high bit fills 1 and truncate low bit. 对正数的补码进行算术移位,符号位保持不变,空余位填‘0’;对负数的补码进行算术左移,符号位保持不变,低位填‘0’, 对负数的补码进行算术右移,符号位保持不变,高位填‘1’,并且舍弃低位。
10.Let the word length is 8, the fixed point integer with 2‘s complement representation of -1 is 11111111 . ―-1‖,则最高位为“1”,后7位的真值为“0000001”,按位取反得“1111110”,再加一得到“1111111”,合起来为:“11111111”。注意,这是对于整数,对于定点小数来说,“-1”是“10000000”
11.In fixed point operation, it will be overflow when the result exceeds the represent range of the computer.( A ) True False
在定点数操作中,当结果超出了计算机所能表示的范围时将会发生溢出。显然是对的
12. For a 8-bit 2‘s complement representation integer number, its minimal value is -128 , its maximal value is 127 . 对于一个八位的补码表示的整数,最小值是-128,最大值是127。
13.A fixed point number is composed of sign bit and numerical part.( B ) True False
11
14. The range of representation for a 2‘s complement number system of 16 bits (including the sign bit) is ( A ).
-215 ~ + (215 -1)
- (215 –1) ~ + (215 –1) -215 ~ + 215
- (215 + 1) ~ + 215
对于一个16位(包含符号位)的系统,补码的表示范围为- 215 ~ + (215 –1)
15.8-4-2-1 BCD code of a number is 0111 1000 1001, then its true value is 789
16. The addition/subtraction algorithm for sign magnitude representation is rather simple.( B ) True False
原码用于乘除法比较简单,补码用于加减法比较简单。因此错误。
18.The number represented in the computer sometimes will be overflow, the fundamental reason is the limited computer word length.( A ) True False
计算机中的数字表示有时候会溢出,其基本原因是计算机字长限制。
19.For fixed point binary calculator, subtraction is implemented through ( B ).
2‘s complement binary subtractor 2‘s complement binary adder sign magnitude decimal adder sign magnitude binary subtractor
对于定点数二进制运算器,减法通过补码的加法来实现。
20.In 2‘s complement addition/subtraction, using 2 sign bits for overflow detection, when the 2 sign bits ?S1S2‘ equals ?10‘, it means that ( C ).
result is positive, with no overflow result is negative, with no overflow result is overflow result is underflow
在补码加减法中,使用双符号位进行溢出检测,当双符号位为“10”时,意味着结果已经溢出,
12
相关推荐: