当前位置:网站首页>Binary source code, inverse code, complement code
Binary source code, inverse code, complement code
2022-07-28 22:38:00 【Xiaomei is working hard】
Catalog
Binary has original code 、 Inverse code 、 The existence form of complement
First , We need to know Computers only recognize 0、1 code , That is what we call binary .
therefore , All the data in the computer is based on Binary complement The form , And participate in the operation .
Then why should we use complement form ?, What is the complement ?
Binary has original code 、 Inverse code 、 The existence form of complement
1、 Original code
Because there are positive numbers 、 Existence of negative numbers , So the computer needs to judge the symbol of the stored number when storing , In the computer , The sign bit of a positive number is 0, The sign bit of a negative number is 1.
for example :byte 1 The original code of = 00000001 -1 The original code of = 10000001
1 - 1 = ? Calculate with binary .
In the computer Only adders exist , therefore 1 - 1 === 1 +(-1) Convert to binary
00000001
10000001
10000010 = -2 1 - 1 = -2 This value is obviously wrong , To solve this problem , There's an irony .
2、 Inverse code
The inverse code is changed on the basis of the original code , The inverse of a positive number is the same as the original , The inverse code of a negative number is the original code Except the sign bit Conduct Take the opposite .
for example :1 The inverse of = 1 The original code of = 00000001 -1 The inverse of = 11111110
00000001
11111110
11111111 Inverse code
10000000 -0 Original code According to the inverse code operation 1 - 1 = -0 , Then there is right in the inverse code 0 Two expressions -0 10000000 and 0 00000000, There is also ambiguity , therefore , There's a complement .
3、 Complement code
Complement is to transform again on the basis of inverse code , The original code of a positive number 、 Inverse code 、 Complement is the same form , The complement of a negative number is based on the inverse +1 .
for example :-1 Complement = 11111110 + 1 = 11111111
00000001
11111111
00000000 0 Complement code Create spillover , The highest position is rounded off
The original code of a positive number 、 Inverse code 、 The complement is the same So get 1 - 1 = 0 The only correct result of .
therefore , The binary in the computer participates in the operation and storage in the form of complement .
边栏推荐
- There will be a black line on the border when the button in the wechat applet is clicked
- Changes in the history of oscilloscope development
- Analysis notes on let (const) temporary dead zone in JS
- Ngx+sql environment offline installation log (RPM installation)
- Sword finger offer II 055. Binary search tree iterator (medium binary search tree iterator)
- PaddleNLP基于ERNIR3.0文本分类:WOS数据集为例(层次分类)
- JS array merging, de duplication, dimensionality reduction (es6: extended operator, set)
- For loops and functions
- 容器化配置启动redis集群 单机6节点 3主3从
- Static route and default route experiment
猜你喜欢
Integrating database Ecology: using eventbridge to build CDC applications
![[CS231N]Lecture_ 2:Image Classification pipelin](/img/4f/de56b071560ada746c587a9dbc5f02.jpg)
[CS231N]Lecture_ 2:Image Classification pipelin

软考网络工程师

【转载】token令牌在登录场景使用

When can I sign up for the 2022 class I constructor examination?
![[connect set-top box] - use ADB command line to connect ec6108v9 Huawei Yuehe box wirelessly](/img/ab/624e9a3240416f8445c908378310ad.png)
[connect set-top box] - use ADB command line to connect ec6108v9 Huawei Yuehe box wirelessly

Which is the file transfer command in the basic services of the Internet

Quadruped robot | gem (elevation map) + fast_ Deployment records of Leo (odometry) environment

Vscode ROS configuration GDB debugging error record

Command line agent: proxychains configuration
随机推荐
删除容器镜像报错解决image is referenced in multiple repositories
JS convert numbers to letters
Integrating database Ecology: using eventbridge to build CDC applications
Mysql内置函数
There will be a black line on the border when the button in the wechat applet is clicked
Overall introduction of Ruiji takeout project
Solve Jupiter: the term 'Jupiter' is not recognized as the name of a cmdlet, function, script file
Analysis notes on let (const) temporary dead zone in JS
redis相关
JVM——自定义类加载器
imx6q gpio复用
ssh免密登陆
Changes in the history of oscilloscope development
使用PCL批量显示PCD点云数据流
PaddleNLP基于ERNIR3.0文本分类以CAIL2018-SMALL数据集罪名预测任务为例【多标签】
If you want to grow rapidly, you must first experience a major blow!
ES6 concept
20-09-27项目迁移到阿里折腾记录(网卡顺序导致服务无法通过haproxy连接到db)
容器化配置启动redis集群 单机6节点 3主3从
Closure, prototype and original link