# [Computer Basics] I talked about the data representation roughly

## [Computer Basics] I talked about the data representation roughly

### Blog description

Part of the information involved in the article comes from the Internet, and of course, there are my own personal summaries and opinions. The purpose of sharing is to build a community and consolidate myself. If the quoted material is infringing, please contact me to delete it! Fortunately I am here, thank you for coming!

### Preface

💿 Learn to learn and start rewinding! If I can't learn new things, I will learn the basics! I review the past and learn more!

(Don’t make trouble, it’s actually a weak foundation. I wrote this more lou summary before, now I’m going to change my homework and make a correction and summary)

### Data in the computer

The data in the computer is stored in binary, and the binary has only two states, which are very good representations, not very (Ginkgo), very mechanical.

``010101010111010101010001``

The above is the binary number, can you understand it? (Computer: Yes!)

Secretly give me the conversion formula of the hexadecimal number. If there is a better one, please remember to comment to me.

• The principle of R system: advance every R
• Convert R to Decimal: Expand by right
• Decimal to R system: short division

### data processing

For general data processing point of view, then, it is from ` type of data, range of data, accuracy of the data, then in the computer, but also consider processing, data storage, and data compatibility platform.`

### `Several representations of data`

`How can computer learners have never heard of the four major codes of original code, inverse code, complement code, and shift code? I'm sorry, the four major codes.`

#### `Truth value`

`Before looking at the four major codes, take a step to understand what the true value is.`

`Literally, the real value!`

`In fact, in actual calculations, after getting a number, it will be converted into binary for calculation. But the actual value is divided into + and - binary is called 161bde26d7261b truth value. + - is the sign bit of .`

``````−5  // 真值 -101
+5  // 真值 +101``````

#### `Original code`

`Let's look at a formula first`

`0 1 represent the sign bit on the basis of the truth value. generally stipulates that 0 represents a positive number and 1 represents a negative number . en, is it wrong? It seems to be the case, mark it up and take the test!`

``````−5  // 真值 -101  // 原码 1101
+5  // 真值 +101  // 原码 0101``````

#### `One's complement`

`Come up with a formula`

`The inverse code of the positive number in the formula is the original code, and the inverse code of the negative number is the sign bit unchanged, and the rest of the bits are inverted bit by bit.`

``````−5  // 真值 -101  // 原码 1101  // 反码 1010
+5  // 真值 +101  // 原码 0101  // 反码 0101``````

#### `Complement`

`The old rules, look at the formula first.`

`The complement of a positive number is equal to the original code of the positive number, and the complement of a negative number is equal to the inverse code + 1.`

``````−5  // 真值 -101  // 原码 1101  // 反码 1010 // 补码 1011
+5  // 真值 +101  // 原码 0101  // 反码 0101 // 补码 0101``````
`The complement code solves the problem of calculating the sign bit of the original code and the inverse code, so the computer usually uses the complement code to calculate!`

#### `Frameshift`

`It means that the floating-point number needs to use the form of shifting code, come, look at the formula!`

`Code shifting generally uses double sign bits in operations, that is, the highest bit is filled with 0, if it is a positive number, the next highest bit is 1; if it is a negative number, the next highest bit is 0.`

`In fact, the sign bit of the complement code is inverted, the value bit remains unchanged, and the obtained number is the code shift.`

``````−5  // 真值 -101  // 原码 1101  // 反码 1010 // 补码 1011  // 移码 00011
+5  // 真值 +101  // 原码 0101  // 反码 0101 // 补码 0101  // 移码 01101``````

### `Type of data`

`This is not the data type of a certain programming language!`

`Here mainly introduces fixed-point numbers and floating-point numbers.`

#### `Fixed point`

` fixed-point number is a number with a fixed decimal point, which is divided into fixed-point integer and fixed-point decimal, which depends on what the decimal point means. The decimal point is fixed at the last position, which is called a fixed-point integer, and in other positions it is a fixed-point decimal.`

`defect:`

`The indicated data range is insufficient, and the word length of the computer is fixed. After the position of the decimal point is determined, the number of digits after the decimal point is also fixed, so some high-precision data cannot be represented.`

#### `Floating point`

`In order to solve the problem of precision, floating-point numbers came out. floating-point number represents a number whose decimal point is not fixed.`

### `Afterword`

`Remember, the basics of computers are not over yet! Just wait and see! (Don’t dare, look forward to your next reading)`

### `grateful`

`Almighty network`

`And the hardworking self, personal blog , GitHub test , GitHub `

`Public Account-Guizimo, Mini Program-Xiaogui Blog`

`If you feel helpful to you, please give me a thumbs up 👍, keep paying attention!`

`计算机计算机基础数据`
`阅读 1.3k发布于 2021-12-18 `
`本作品系原创，采用《署名-非商业性使用-禁止演绎 4.0 国际》许可协议`
`归子莫`

`信息安全工程师，现职前端工程师的全栈开发，三年全栈经验。`

`973 声望`
`1.2k 粉丝`
`0 条评论`
`评论支持部分 Markdown 语法：**粗体** _斜体_ [链接](http://example.com) `代码` - 列表 > 引用。你还可以使用 @ 来通知其他用户。`
`21`
``` window.g_useSSR = true; window.g_initialProps = {"router":{"location":{"pathname":"\u002Fa\u002F1190000041141455\u002Fen","search":"","hash":"","query":{},"state":undefined,"key":"8n7js2"},"action":"POP"},"@@dva":0,"action":{"1190000041141455":{"votes":2,"isLiked":false,"isHated":undefined,"bookmarks":1,"isBookmarked":false}},"sfApp":{"comment":{"isFetchComments":false,"isShowComment":false}},"article":{"articles":{"rows":[],"size":0,"offset":0,"hasMore":true,"error":false,"loading":false,"isStopLoad":false,"cutLoadNum":1,"isLoadedFirstRecommend":false,"query":""},"currentTab":""},"articleDetail":{"artDetail":{"1190000041141455":{"title":"数据 - [Computer Basics] I talked about the data representation roughly_个人文章","keywords":"计算机,计算机基础,数据","description":"Part of the information involved in the article comes from the Internet, and of course, there are my own personal summaries and opinions. The purpo...","article":{"id":1190000041141455,"title":"[Computer Basics] I talked about the data representation roughly","cover":"\u002Fimg\u002FbVcWMV0?spec=cover","tags_list":"1040000000090094,1040000002431421,1040000000441863","user_id":1030000022384638,"blog_id":0,"excerpt":"Part of the information involved in the article comes from the Internet, and of course, there are my own personal summaries and opinions. The purpo...","parsed_text":"","is_bookmarked":false,"is_liked":false,"created":1639833261,"modified":1639833261,"real_views":1290,"real_unique_views":1067,"votes":2,"bookmarks":1,"status":0,"origin_url":"","article_type":1,"license":"1","langs":["en"],"comments":0,"is_edited":false,"ip_address":null,"tags":[{"id":1040000000090094,"url":"\u002Ft\u002F%E8%AE%A1%E7%AE%97%E6%9C%BA","name":"计算机","icon_url":""},{"id":1040000002431421,"url":"\u002Ft\u002F%E8%AE%A1%E7%AE%97%E6%9C%BA%E5%9F%BA%E7%A1%80","name":"计算机基础","icon_url":""},{"id":1040000000441863,"url":"\u002Ft\u002F%E6%95%B0%E6%8D%AE","name":"数据","icon_url":""}],"user":{"id":1030000022384638,"name":"归子莫","avatar_url":"https:\u002F\u002Favatar-static.segmentfault.com\u002F231\u002F781\u002F2317811983-61ddaa497bd84_huge128","url":"\u002Fu\u002Fguizimo","rank":973,"rank_word":"973","is_followed":false,"excerpt":"\u003Cp\u003E信息安全工程师，现职前端工程师的全栈开发，三年全栈经验。\u003C\u002Fp\u003E","followers":1168,"articles":306,"user_auth":null},"status_key":"available"},"blog":null,"actions":[],"member_actions":[],"article_types":{"1":"原创","2":"转载","3":"翻译"},"pay_info":null,"extra":{"reason":null,"operator":null,"operator_time":null},"tag":{"name":"数据","url":"\u002Ft\u002F%E6%95%B0%E6%8D%AE","icon_url":""},"isServerLoaded":true}},"alertMsg":{"showAlert":false,"msg":""},"articleRelated":[],"quotedData":{"rows":[],"page":1,"size":5,"total_page":0,"total":0}},"editor":{"markdownContent":"","title":{"value":"","isInvalid":false,"errorMsg":""},"log":{"value":"","isInvalid":false,"errorMsg":""},"tags":{"value":[],"isInvalid":false,"errorMsg":""},"draftInfo":{"id":"","status":""},"isFull":false,"initTags":[],"detail":{}},"global":{"sessionUser":null,"isHiddenHeader":false,"isHiddenFooter":false,"title":"[Computer Basics] I talked about the data representation roughly - SegmentFault 思否","isShowLogin":false,"beginnerGuideState":{"visible":false,"type":1},"isShowBindMobile":false,"authChannel":"","unactivated":false,"isShowRegister":false,"headOptions":{"keywords":"计算机,计算机基础,数据","description":"Part of the information involved in the article comes from the Internet, and of course, there are my own personal summaries and opinions. The purpo..."},"notices":[],"sessionInfo":{"key":"463687879ef8c97b6d32d2c0b57a336e","login":false,"id":null},"singleNotice":"","currentRoute":{"customLayout":false,"headerType":undefined,"platform":undefined,"eggCtx":{"request":{"method":"GET","url":"\u002Fa\u002F1190000041141455\u002Fen","header":{"host":"segmentfault.com","x-https-cn":"yes","x-ddos":"yes","connection":"close","user-agent":"CCBot\u002F2.0 (https:\u002F\u002Fcommoncrawl.org\u002Ffaq\u002F)","accept":"text\u002Fhtml,application\u002Fxhtml+xml,application\u002Fxml;q=0.9,*\u002F*;q=0.8","accept-language":"en-US,en;q=0.5","accept-encoding":"br,gzip","x-https-ga":"yes","x-forwarded-for":"3.236.225.157"}},"response":{"status":404,"message":"Not Found","header":{"set-cookie":["csrfToken=G1BhE96TUAUdOErhhKogRO6g; path=\u002F","PHPSESSID=463687879ef8c97b6d32d2c0b57a336e; path=\u002F; max-age=604800; expires=Fri, 19 Aug 2022 03:55:40 GMT; domain=.segmentfault.com"]}},"app":{"env":"prod","name":"server","baseDir":"\u002Fusr\u002Fsrc\u002Fapp","subdomainOffset":2,"config":"\u003Cegg config\u003E","controller":"\u003Cegg controller\u003E","httpclient":"\u003Cegg httpclient\u003E","loggers":"\u003Cegg loggers\u003E","middlewares":"\u003Cegg middlewares\u003E","router":"\u003Cegg router\u003E","serviceClasses":"\u003Cegg serviceClasses\u003E"},"originalUrl":"\u002Fa\u002F1190000041141455\u002Fen","req":"\u003Coriginal node req\u003E","res":"\u003Coriginal node res\u003E","socket":"\u003Coriginal node socket\u003E"}},"letterNum":0,"noticeNum":0,"serverData":{"userAgent":"CCBot\u002F2.0 (https:\u002F\u002Fcommoncrawl.org\u002Ffaq\u002F)","Token":undefined,"X-Forwarded-For":"3.236.225.157"},"userStat":{},"newTask":{},"followedTags":[],"globalCss":"","baiduOxAppState":{"isShow":false,"copyUrl":""},"pageUsers":{},"wxShareCover":"","isBaiduOxApp":false,"showProductAuthModal":{"isShow":false,"title":""},"routeInterceptor":{"path":""},"safeCheckModal":{"isShow":false,"pageSource":""},"followSFState":{"isShow":false}},"video":{"videoData":{},"relationVideos":[],"videos":{"rows":[],"limit":0,"offset":0,"hasMore":true},"lives":[]},"activity":{"recommendList":[],"newestList":[],"finishedList":{},"eventType":[],"cityList":[]},"activityDetail":{"detailData":{}},"badges":{"listData":{},"detail":{},"records":{"page":1,"rows":[]},"loading":false},"blogHome":{"loading":false,"blogDetail":{},"articleData":{}},"blogs":{"channels":{},"articles":{"mode":"scrollLoad","page":1,"rows":[],"size":0,"offset":0,"hasMore":true,"error":false,"loading":false,"isStopLoad":false,"cutLoadNum":1,"isLoadedFirstRecommend":false},"currentTab":"recommendation","notices":{},"events":{},"recommendArticles":{},"hotQuestions":{},"hotTestData":{},"banners":{},"showOneLoading":false},"bookmark":{"loading":false,"detailInfo":{},"listInfo":{"page":1,"total_page":0,"rows":[]}},"deactivate":{"checkResult":{}},"dianping":{"homeInfo":{},"categroies":[],"categoryList":[],"categoryInfo":{},"loading":false,"companyInfo":{}},"dpDetail":{"dpDetail":{},"dpList":{"page":1,"total_page":10,"rows":[]},"usedsAndWishs":{"useds":0,"wisheds":0},"currentTab":"votes"},"draft":{"listData":{"rows":[],"hasMore":false,"page":1},"inviteListData":{"rows":[],"hasMore":false,"page":1},"inviteRegisterList":{"rows":[],"hasMore":false,"page":1},"loading":true},"help":{"reportRecord":{},"violationRecord":{},"appealsRecord":{},"communityGuide":{},"currentTab":"report"},"letterDetail":{"letterData":{"rows":[],"page":1,"size":100,"total_page":0,"hasMore":true},"loading":true,"readAll":false},"inbox":{"list":{"page":1,"count":0,"rows":{"inbox":{},"messages":[]},"total_page":1},"loading":false},"note":{"notes":{"rows":[],"page":1,"size":30,"hasMore":false,"sort":"modified","query":"mine","q":""},"bookmarkNotes":{"rows":[],"page":1,"size":30,"hasMore":false,"sort":"modified"},"noteDetail":{},"detail":[]},"noticeDetail":{"noticeData":{"rows":[],"offset":"","hasMore":true,"isStopScrollLoad":false,"loadedNum":1},"loading":true,"readAll":false},"personal":{"realTabName":"timeline","personalInfo":{},"listInfo":{},"blogs":[],"tags":{},"badges":{},"ranks":{},"loading":false,"financeInfo":{},"dashboardInfo":{},"dashboardHot":{"offset":1,"rows":[],"hasMore":false},"hotLoading":false},"personalSetting":{"userInfo":{},"accountInfo":{},"notifyInfo":{},"blockInfo":{"rows":[],"page":1,"total_page":1},"labInfo":{},"privacyInfo":{},"errorMsg":{"type":"","msg":""}},"portal":{"pageData":{},"noticeData":[]},"question":{"questionDetail":{},"relateDetail":{},"quotedData":{}},"questionList":{"questionList":{"page":1,"size":30,"count":0,"total_page":0,"rows":[]},"updateList":{"offset":"","rows":[]},"showLoading":false,"hostData":{},"userRank":{},"notices":{},"loading":false,"currentTab":"","isServerLoad":true,"asidesData":{}},"review":{"loading":true,"articelDetail":{},"suggestEditDetail":{},"tagEditDetail":{},"questionDetail":{},"answerDetail":{},"closeDetail":{},"tagCleanDetail":{},"homeData":{"rows":[]}},"rivision":{"breadNav":[],"detail":[]},"search":{"result":{"rows":[],"page":1,"size":15,"q":"","total_page":0,"query":""}},"sites":{"questionList":{"page":1,"size":30,"count":0,"total_page":0,"rows":[]},"loading":false,"information":{},"articles":[]},"sitesSet":{"loading":false,"information":{}},"tag":{"rows":[],"loadMoreType":"scroll","offset":0,"page":1,"pageSize":30,"info":{},"loadedNum":0,"hasMore":false,"isStopLoad":false,"showLoading":true,"type":"","totalPage":0,"sort":"newest","allTagList":{}},"tagRivision":{"tagInfo":{},"detail":[]},"userTop":{"data":{}},"loading":{"global":false,"models":{"articleDetail":false},"effects":{"articleDetail\u002FgetArtDetail":false,"articleDetail\u002FgetQuoted":false}}}; (function () { var data = window.g_initialProps["gtagData"] || window["gtagData"]; var script = document.createElement("script"); script.src = "https://www.googletagmanager.com/gtag/js?id=UA-918487-8"; script.async = true; script.onload = function () { window.dataLayer = window.dataLayer || []; window.gtag = function () { window.dataLayer.push(arguments); }; window.gtag("js", new Date()); window.gtag("config", "UA-918487-8"); data && window.gtag("set", data); }; document.getElementsByTagName("head")[0].appendChild(script); })(); ```