当前位置:网站首页>机器码介绍
机器码介绍
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
边栏推荐
- BIOTIN ALKYNE CAS: 773888-45-2 Price, Supplier
- 13.
lt.647. Palindromic substring + lt.516. Longest palindrome subsequence - Pr第二次培训笔记
- Exception (abnormal) and Error (error) difference analysis
- Gradle的安装配置
- Build your own web page on the Raspberry Pi (2)
- 快速上手 Mockito 单元测试框架
- -飞机大战-
- 第四次培训
- Common lipophilic cell membrane dyes DiO, Dil, DiR, Did spectrograms and experimental procedures
猜你喜欢

2. 两数相加

Talking about GIS Data (6) - Projected Coordinate System

数据分析 第一篇

用scikit-learn学习谱聚类

Harmony OS Date ano UI 】 【 】 the basic operation

C-PHY速率

MCM box model modeling method and source analysis of atmospheric O3

idea uses @Autowired annotation to explain the reasons and solutions

Apache DolphinScheduler版本2.0.5分布式集群的安装

HarmonyOS应用开发第一次培训
随机推荐
背压机制
Djiango第二次培训
【 Harmony OS 】 【 ano UI 】 lightweight data storage
详解Nurbs曲线
2017-06-11 Padavan 完美适配newifi mini【adbyby+SS+KP ...】youku L1 /小米mini
反射注解基础
曲线特征----曲线弯曲程度的探究
Coordinate knowledge in digital twin campus scenarios
The problem that the rosbag tool plotjuggler cannot open rosbag
Object类与常用API
Harmony OS Date ano UI 】 【 】 the basic operation
High availability, two locations and three centers
Pr第二次培训笔记
ss-5.consul服务端+生产者+消费者
web安全-PHP反序列化漏洞
minio下载文件乱码或者是一条横线
Flask Web 报错:
Junit
1095 解码PAT准考证 (25 分)(C语言)
-角谷猜想-