当前位置:网站首页>Why are negative numbers in binary represented in two's complement form - binary addition and subtraction
Why are negative numbers in binary represented in two's complement form - binary addition and subtraction
2022-08-10 05:03:00 【Ghost Rider】
Article table of contents
Related Notes
Negative representation of byte data type in Java—complement representation
Body
A little explanation of why negative numbers of binary data types are represented in two's complement form
The editor's purpose is to do binary addition and subtraction
Authentication
Use source code
1+(-1)
Obviously the answer is wrong
Use two's complement
1+(-1)
Of course, we need multiple verifications, such as 5-3
Verification successful
That's it, it may seem strange and incomprehensible, but this representation is actually very rigorous and correct, isn't it amazing?
Note
If we use out-of-range binary addition and subtraction, such as 127 + 1
127 + 1
边栏推荐
- redis basic data types
- 深度学习——循环神经网络RNN 未完待续
- 深入学习Synchronized各种使用方法
- mysql cdc (2.1.1)inital snapshot数据库的时候设置了5个并发度,se
- 2022 security officer C certificate test and simulation test in shandong province
- FPGA工程师面试试题集锦31~40
- Nexus_仓库类型
- SQL database field to append to main table
- 2022 T Elevator Repair Exam Questions and Mock Exams
- webrtc学习--webrtc源码获取
猜你喜欢
随机推荐
西门子Step7和TIA软件“交叉引用”的使用
qwt库的编译和使用
JS获取简单当前时间的年、月、日、时间等
webrtc学习--webrtc源码获取
网络层与数据链路层
curl命令介绍
2022G3锅炉水处理考试模拟100题及模拟考试
盼他一切安好
【无标题】
栈与队列 | 用栈实现队列 | 用队列实现栈 | 基础理论与代码原理
咨询cdc 2.0 for mysql不执行flush with read lock.怎么保证bin
SQLSERVER 2008 解析 Json 格式数据
线程(中):线程安全
暑期学前作业
JS gets the year, month, day, time, etc. of the simple current time
华为交换机配置日志推送
Promise原理及实现
2022年A特种设备相关管理(电梯)考试模拟100题及答案
SQL database field to append to main table
tensorflow分词深度学习——影评预测