当前位置:网站首页>How to understand that binary complement represents negative numbers
How to understand that binary complement represents negative numbers
2022-07-07 15:38:00 【sgmcy】
First , If it means a positive number
that N position , The maximum positive number expressed is 2^N -1
in other words , If it's a byte ,8bit, The maximum positive number is 255
If expressed as a negative number The maximum representation range is -2^(N-1) ~ 2^(N-1) - 1
in other words , If calculated in absolute value , The absolute value of a negative number plus the absolute value of a positive number ,
2^(N-1) + 2^(N-1) - 1 It becomes 2^N -1
Find negative numbers 2 Hexadecimal complement representation , First find the binary form of positive numbers , Then each bit is reversed , And then add 1 that will do .
In the computer , All data exists in the form of complement , Don't mention the original code , Inverse code or something , Remember to have a headache . Just remember the complement . Because all data exists in complement , Then just remember one .
Then why should it exist in the form of complement ? That genius came up with this storage method ?
Refer to this post , It's very detailed :
A clock chart One minute to understand Computer complement _ Travel great blog -CSDN Blog
The reason why I understand the way clocks express complement , When I was in Graduate School , Our teacher told us , When I finished speaking, it suddenly became clear .
边栏推荐
- Ctfshow, information collection: web7
- What are PV and UV? pv、uv
- 什么是pv和uv? pv、uv
- Android -- jetpack: the difference between livedata setValue and postvalue
- MongoDB数据库基础知识整理
- [server data recovery] a case of RAID data recovery of a brand StorageWorks server
- Starting from 1.5, build a microservice framework link tracking traceid
- 2. 堆排序『较难理解的排序』
- Why do we use UTF-8 encoding?
- Unity's ASE achieves full screen sand blowing effect
猜你喜欢
Unity之ASE实现卡通火焰
Ctfshow, information collection: web5
CTFshow,信息搜集:web12
There is a cow, which gives birth to a heifer at the beginning of each year. Each heifer has a heifer at the beginning of each year since the fourth year. Please program how many cows are there in the
如何在opensea批量发布NFT(Rinkeby测试网)
[机缘参悟-40]:方向、规则、选择、努力、公平、认知、能力、行动,读3GPP 6G白皮书的五层感悟
MySQL bit类型解析
【数字IC验证快速入门】18、SystemVerilog学习之基本语法5(并发线程...内含实践练习)
Summer safety is very important! Emergency safety education enters kindergarten
CTFshow,信息搜集:web9
随机推荐
【Markdown语法高级】让你的博客更精彩(四:设置字体样式以及颜色对照表)
CTFshow,信息搜集:web5
What are PV and UV? pv、uv
【數字IC驗證快速入門】26、SystemVerilog項目實踐之AHB-SRAMC(6)(APB協議基本要點)
Window环境下配置Mongodb数据库
CTFshow,信息搜集:web12
Implementation of crawling web pages and saving them to MySQL using the scrapy framework
[markdown grammar advanced] make your blog more exciting (IV: set font style and color comparison table)
[quick start of Digital IC Verification] 29. Ahb-sramc (9) (ahb-sramc svtb overview) of SystemVerilog project practice
Stream learning notes
写一篇万字长文《CAS自旋锁》送杰伦的新专辑登顶热榜
【数据挖掘】视觉模式挖掘:Hog特征+余弦相似度/k-means聚类
[understanding of opportunity -40]: direction, rules, choice, effort, fairness, cognition, ability, action, read the five layers of perception of 3GPP 6G white paper
[data mining] visual pattern mining: hog feature + cosine similarity /k-means clustering
Comparable and comparator of sorting
数学建模——什么是数学建模
leetcode 241. Different Ways to Add Parentheses 为运算表达式设计优先级(中等)
Ctfshow, information collection: web13
Stm32f103c8t6 PWM drive steering gear (sg90)
Monthly observation of internet medical field in May 2022