当前位置:网站首页>Original code complement
Original code complement
2021-10-14 03:06:53 【Programming China】
Complement code Is a kind of use Binary system A method of representing signed numbers , It's also a way to change the sign of a number , Often in Computer science Use in . The complement is defined as a binary number of signed bits .
The biggest advantage of complement system is that it can be used in addition or subtraction , There is no need to use different calculation methods because of the positive and negative of the number . Only one addition circuit can handle all kinds of signed addition , And subtraction can be represented by the complement of one number plus another , Therefore, as long as there is an addition circuit and a complement circuit, all kinds of signed addition and subtraction can be completed , It's quite convenient in circuit design .
Why complement 0 There is only one ?
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
The relationship between complement and original code : Complement code = The original code is reversed except for the sign bit +1( The complement symbol bit can participate in the operation )
Integers (0000 0000) Take the opposite :0111 1111 Add 1:0000 0000
(1000 0000) Take the opposite :1111 1111 Add 1:0000 0000( Carry on 1 Be abandoned , Just don't take values anymore )
Floating point numbers (0.0000) Take the opposite :0.1111 Add 1:0.0000
(1.0000) Take the opposite :1.1111 Add 1:0.0000
Why can an eight digit integer complement represent -128, Floating point numbers can represent -1?
Truth value |
Original code |
Complement code |
+0 |
0000 0000 |
0000 0000 |
-0 |
1000 0000 |
0000 0000 |
1 |
0000 0001 |
0000 0001 |
2 |
0000 0010 |
0000 0010 |
… |
… |
… |
127 |
0111 1111 |
0111 1111 |
-128 |
nothing |
1000 0000 |
-127 |
1111 1111 |
1000 0001 |
-126 |
1111 1110 |
1000 0010 |
… |
… |
… |
-2 |
1000 0010 |
1111 1110 |
-1 |
1000 0001 |
1111 1111 |
or -127-1=1000 0001+1111 1111=1000 0000( Carry away )
Because of the complement +0 and -0 Use the same number to represent , So leave a number to represent -128
Truth value |
Original code |
Complement code |
+0 |
0.0000 |
0.0000 |
-0 |
1.0000 |
0.0000 |
1/16 |
0.0001 |
0.0001 |
1/8 |
0.0010 |
0.0010 |
3/16 |
0.0011 |
0.0011 |
1/4 |
0.0100 |
0.0100 |
5/16 |
0.0101 |
0.0101 |
3/8 |
0.0110 |
0.0110 |
7/16 |
0.0111 |
0.0111 |
1/2 |
0.1000 |
0.1000 |
… |
… |
… |
15/16 |
0.1111 |
0.1111 |
1 |
nothing |
1.0000 |
-15/16 |
1.1111 |
1.0001 |
… |
… |
… |
-3/8 |
1.0110 |
1.1010 |
-5/16 |
1.0101 |
1.1011 |
… |
… |
… |
-1/16 |
1.0001 |
1.1111 |
版权声明
本文为[Programming China]所创,转载请带上原文链接,感谢
https://chowdera.com/2021/10/20211002145822822W.html
边栏推荐
- Can Alipay earn money through advanced management? What is Alipay's advanced financial return?
- Cadre de développement Android MVP, résumé de l'entrevue
- Go Connect MSSQL Server Database [Pit encountered]
- Is Alipay robust financial security? Is there a risk?
- How does Alipay get money from advanced financial management? Is Alipay reliable in financing?
- How to redeem Alipay's advanced financial management? How is Alipay's advanced financial management closed?
- Does Alipay's prudent financial accounting lose its principal? Which is good for Alipay's prudent financial management?
- How to manage Alipay's robust financial management? Is Alipay reliable financing reliable?
- How do you collect Alipay gold tickets? How can Alipay gold ticket be closed?
- How can financial management Xiaobai get started easily through these methods
猜你喜欢
-
What is stock repurchase and why
-
Are stock analysts reliable? What professional skills do stock analysts need to master
-
What is the meaning of yesterday's trading performance? What do you think
-
Luogu p4211 [lnoi2014] LCA problem Explanation
-
Écrire un seul test avec une valeur de retour nulle
-
How much money can an ordinary person earn in a day
-
What stocks are there in financial stocks? When is the market better
-
Can I buy the stocks that rose yesterday? Analyze from different situations
-
Overview of Huaxia return hybrid a fund
-
Does the subscription of new shares of Beijing stock exchange need market value? What are the conditions
随机推荐
- How much is the P / E ratio in the normal range? Are the P / E ratios of different industries the same
- What is the normal turnover rate? The answer is this
- Is the interest rate of small bank deposits high and safe? Will it break even?
- Where is the current product with a yield of 4% of Huatong bank? How to calculate the interest withdrawn in advance?
- Which bank is Fu e deposit? Is the annual interest rate of fue deposit s (5 years) as high as 4% safe?
- 2020-11-17
- Ruby‘s Adventure: 2D Beginner 一、 Unity入门
- 团队项目(一)(江山代有才人秃队)
- 好代码是管出来的——使用Jenkins搭建CI服务器
- No buffer space available tcp协议无法释放问题
- 解决:【安全警报】该站点安全证书的吊销信息不可用,是否继续?
- 脑机接口数据分析工具EEGLAB01---安装eeglab
- Projet Open Source: Découvrez comment résoudre l'ensemble du processus de développement et de déploiement en 10 minutes!
- HTV camera RTSP Video Streaming in High version Google Chrome Zero Delay play Effect Demonstration video, support for h.265 Format
- Why do small banks have higher interest rates than large banks? Why don't everyone want to deposit in a small bank?
- Why do small banks have high interest rates? Are small bank deposits risky?
- How about Huatong bank Fu e deposit s (1 year)? Is the income high?
- What are the stock group teacher brainwashing scams? Can the money lost be recovered?
- How does wechat finance make money? How to make money on wechat?
- Has Chao Zhaojin ever lost money? What are the advantages?
- Can Laobaigan liquor stock still rise? Is Laobaigan wine worth long-term investment
- How about rely on smart phone stock? Thousands of shares and thousands of comments of rely on smart electronics
- Is Fangda carbon stock worth holding for a long time? Future market trend of Fangda carbon stock
- Can green water source stocks be held for a long time? Why don't blue water stocks rise
- 腦機接口數據分析工具EEGLAB01---安裝eeglab
- 解决:【安全警報】該站點安全證書的吊銷信息不可用,是否繼續?
- Outil d'analyse des données de l'interface cerveau - ordinateur eeglab01 - - - installation eeglab
- Résolution: [alerte de sécurité] l'information sur la révocation du certificat de sécurité de ce site n'est pas disponible. Voulez - vous continuer?
- Aucun protocole TCP disponible dans l'espace tampon ne peut libérer le problème
- Le bon Code est géré - - construire un serveur ci en utilisant Jenkins
- Projet d'équipe (1) (équipe chauve de Jiangshan Dai Youcai)
- Ruby 's Adventure: 2D Beginner I, Unity Starting
- 17 novembre 2020
- Will Yonghe Zhikong stock rise? Analysis on stock value of Yonghe intelligent control
- Is Yingjia gongjiu stock suitable for long-term holding? Thousands of shares and thousands of comments on Yingjia gongjiu stock
- How about Xingwang Ruijie stock? STARNet Ruijie stock thousands of shares and thousands of comments
- How about Yunhai metal stock? Yunhai metal stock thousand shares thousand comments
- Why doesn't TCL technology stock rise? Reasons for TCL technology stocks falling every day
- High quality low price stocks currently at the bottom (list of high quality low price stocks below RMB 10)
- 10 bull stocks with the largest increase in 2021 (demon stocks with a 10 fold increase this year)