(2N-1)or-天津大学计算机学院.ppt

  1. 1、本文档共88页,可阅读全部内容。
  2. 2、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
  3. 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载
  4. 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
(2N-1)or-天津大学计算机学院

Store –40 in a 16-bit memory location using two’s complement representation. First change the number to binary 101000. Add ten 0s to make a total of N (16) bits, 0000000000101000. The sign is negative, so leave the rightmost 0s up to the first 1 (including the 1) unchanged and complement the rest. The result is: 1111111111011000 Solution Example 13 Example of storing two’s complement integers in two different computers Decimal ------------ +7 -7 +124 -124 +24,760 -24,760 8-bit allocation ------------1111100110000100 overflow overflow 16-bit allocation ---------------------------- 0000000000000111 1111111111111001 0000000001111100 1111111110000100 0110000010111000 1001111101001000 Interpretation How do you interpret a twos complement binary represen-tation in decimal? The process involves these steps: 1. If the leftmost bit is 0 (positive number), a. Change the whole number from binary to decimal. b. Put a plus sign (+) in front of the number . 2. If the leftmost bit is 1 (negative number), a. Leave the rightmost bits up to the first 1 (inclusive) unchanged. Complement the rest of the bits. b. Change the whole number from binary to decimal. c. Put a negative sign (-) in front of the number. Interpret in decimal if the number was stored as a two’s complement integer. The leftmost bit is 1. The number is negative. Leave 10 at the right alone and complement the rest. The result is. The two’s complement number is 10. So the original number was –10. Solution Example 14 Summary of integer representation Contents of Memory ------------ 0000 0001 0010 0011 0100 0101 0110 0111 1000 1001 1010 1011 1100 1101 1110 1111 Unsigned ------------ 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 Sign-and-Magnitude --------- +0 +1 +2 +3 +4 +5 +6 +7 -0 -1 -2 -3 -4 -5 -6 -7 One’s Complement --------- +0 +1 +2 +3 +4 +5 +6 +7 -7 -6 -5 -4 -3 -2 -1 -0 Two’s Complement ---

您可能关注的文档

文档评论(0)

youbika + 关注
实名认证
内容提供者

该用户很懒,什么也没介绍

1亿VIP精品文档

相关文档