当前位置:网站首页>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

边栏推荐
- 深度梳理:防止模型过拟合的方法汇总
- 深度学习——循环神经网络RNN 未完待续
- 【论文笔记】Prototypical Contrast Adaptation for Domain Adaptive Semantic Segmentation
- 暑期学前作业
- RadiAnt DICOM Viewer 2022.1 Crack
- What is the relationship between legal representative and shareholders?
- leetcode每天5题-Day12
- WAN技术-1广域网接口
- 【u-boot】u-boot驱动模型分析(02)
- Using the DatePicker date control, Prop being mutated: "placement" error occurs
猜你喜欢

什么是遗留代码:有效地处理遗留代码的8个小贴士

60行从零开始自己动手写FutureTask是什么体验?

【论文笔记】Prototypical Contrast Adaptation for Domain Adaptive Semantic Segmentation

EasyGBS连接mysql数据库提示“can’t connect to mysql server”,该如何解决?

2022年A特种设备相关管理(电梯)考试模拟100题及答案

网络层与数据链路层

万字总结:分布式系统的38个知识点

leetcode每天5题-Day10

一篇文章掌握整个JVM,JVM超详细解析!!!

Unity implements UI edge detection and drag-and-drop functions
随机推荐
剑指Offer 033.变位数组
使用 DatePicker 日期控件,发生 Prop being mutated: “placement“ 报错问题
redis basic data types
60行从零开始自己动手写FutureTask是什么体验?
Thread.sleep, Thread.yield 作用解释
Stacks and Queues | Implementing Queues with Stacks | Implementing Stacks with Queues | Basic Theory and Code Principles
Acwing 59. 把数字翻译成字符串 计数类DP
2022年A特种设备相关管理(电梯)考试模拟100题及答案
【Web3 系列开发教程——创建你的第一个 NFT(7)】创建一个 NFT DApp,给你的 NFT 赋予属性,例如图片
SQL Server query optimization
Consulting cdc 2.0 for mysql does not execute flush with read lock. How to ensure bin
基于BP神经网络的多因素房屋价格预测matlab仿真
SQL数据库字段追加到主表
SQLSERVER 2008 解析 Json 格式数据
众昂矿业:萤石下游需求强劲
MySQL事务的保证机制
SQL Server查询优化
【无标题】
Using the DatePicker date control, Prop being mutated: "placement" error occurs
干货 | 查资料利器:线上图书馆