当前位置:网站首页>机器码介绍
机器码介绍
2022-08-03 05:10:00 【El mundo】
机器码
1 原码
记[X]原;最高位为符号位:0+ 1-
2 反码
记[X]反;最高位为符号位:0+1-
if X>0
[X]反 = [X]原
if X<0
[X]反 = X的绝对值取反(符号位不变,其他位取反)
3 补码
记[X]补;最高位为符号位:0+1-
if X>0
[X]补 = [X]反 = [X]原
if X<0
[X]补 = [X]反 + 1
PS: 1000 0000(补) 表示 -2^7
Example:
PS:小数 0.5的二进制码为0.100 0000;其中“.”为小数点位置。最高位为符号位。
4 机器数的加减法:
4.1 原码加减法
符号相同,数值相加
符号相异,绝对值大的数值 - 绝对值小的数值;符号取绝对值大的。
4.2 补码加减法
4.2.1 和的补码 = 补码求和
[X+Y]补 = [X]补 + [Y]补
4.2.2 差的补码 = 被减数的补码 + 减数取负后的补码
[X-Y]补 = [X]补 + [-Y]补
[Y]补 --(全部位取反,+1)–> [-Y]补
Example1:
X=0100 0100 ; Y=0000 1110,求X+Y,X-Y
解:
X+Y = 0100 0100 + 0000 1110 = 0101 0010
因为 X - Y >0,所以 [X-Y] = [X-Y]补 = [X]补 + [-Y]补
= 0100 0100 + 1111 0010 = 0011 0110
Example2:
X=0011 0110 ; Y=1011 0011,求X+Y,X-Y
解:
因为 X + Y>0,所以 [X+Y] = [X+Y]补 = [X]补 + [Y]补
= 0011 0110 + 1100 1101 = 0000 0011
因为 X - Y >0,所以 [X-Y] = [X-Y]补 = [X]补 + [-Y]补
= 0011 0110 + 0011 0011 = 0110 1001
边栏推荐
- Secondary development of WinForm controls
- Apache DolphinScheduler版本2.0.5分布式集群的安装
- Lambda表达式案例
- UV decomposition of biotin - PEG2 - azide | CAS: 1192802-98-4 biotin connectors
- VSO Downloader Ultimate 5.0.1.45 中文多语免费版 在线视频下载工具
- 如何不耍流氓的做运维之-SHELL脚本
- 4.如何避免缓存穿透、缓存击穿、缓存雪崩
- 1079 延迟的回文数 (20 分)
- Ali cloud object storage oss private barrels to generate links
- 2017-06-11 Padavan 完美适配newifi mini【adbyby+SS+KP ...】youku L1 /小米mini
猜你喜欢
随机推荐
MCM box model modeling method and source analysis of atmospheric O3
Alienware上线首个数字时装AR试穿体验
1054 求平均值 (20 分)
CAD有生僻字如何打出来、如何提交软件相关问题或建议?
设计模式——组合模式、享元模式(Integer缓存)(结构型模式)
2022暑假牛客多校联赛第一场
js实现一个 bind 函数
安装IIS服务(Internet信息服务(Internet Information Services,简写IIS,互联网信息服务)
Js学习笔记(四)
Shell conditional statement judgment
ss-4.2 多个eureka集群案例
Response 重写设置返回值
[Harmony OS] [ARK UI] ETS context basic operations
Common lipophilic cell membrane dyes DiO, Dil, DiR, Did spectrograms and experimental procedures
High availability, two locations and three centers
【HMS core】【Ads Kit】Huawei Advertising——Overseas applications are tested in China. Official advertisements cannot be displayed
详解Nurbs曲线
13.
lt.647. Palindromic substring + lt.516. Longest palindrome subsequence Get the Ip tool class
-钞票兑换-









