In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/02 Report--
Xiaobian to share with you what is the way of data storage and operation in the computer, I believe most people still do not know how, so share this article for your reference, I hope you have a lot of harvest after reading this article, let's go to understand it together!
Data is stored and manipulated in a computer in binary. Because binary numbers have only two basic symbols,"0" and "1," and computers are composed of logic circuits, logic circuits usually have only two states, switch on and off, these two states can be represented by "1" and "0."
Data in a computer is represented in binary. Data in computers can be divided into two categories according to their basic uses: numerical data and non-numerical data. Numeric data indicates a specific quantity, which can be positive or negative. Non-numerical data mainly includes characters, sounds, images, etc. This kind of data needs to be converted into binary representation in a specific coding mode before being stored and processed in a computer.
(1) The concept of system
The base system is also the carry system, which is a carry method stipulated by people. For any base system--X base system, it means that the number operation at a certain position is one bit every X. Decimal is decimal, hexadecimal is hexadecimal, binary is binary.
In a number system using carry counting, if only r basic symbols are used to represent values, it is called a radix-r Number System, and r is called the radix of the number system. The common characteristics of different number systems are as follows:
(1) Each number system has a definite symbol set. For example, the decimal number system has ten basic symbols: 0, 1, 2..., 9。The binary number system has two basic symbols: 0 and 1.
(2) Each number system uses positional notation. That is, the number in different positions represents different values, which are related to the weight of its position.
For example: decimal 1234.55 can be expressed as
1234.55=1×10^3+2×10^2+3×10^1+4×10^0+5×10^(-1)+5×10^(-2)
It can be seen that the weight values in various carry counting systems are exactly some power of the basis. Therefore, any number represented by any carry counting system can be written as a polynomial expanded by weight.
(2) Why use binary in computers
The binary system used by computers is determined by its implementation mechanism. We can understand it this way: the basic components of a computer are composed of integrated circuits, which can be regarded as gate circuits (of course, there is no such simple thing).
When the computer is working, the circuit is energized, and there is a voltage at each output. The high and low voltages are converted into binary by analog-to-digital conversion: high levels are represented by 1, low levels by 0. That is to say, analog circuits are converted into digital circuits. Here, the high level and low level can be artificially determined. Generally, 2.5 volts or less is the low level, and 3.2 volts or more is the high level
Electronic computers can process and process information at extremely high speeds, including data processing and processing, and have great information storage capacity. Data in the computer to the physical state of the device, using binary digital system, computer processing all the characters or symbols should also be represented by binary code. The advantages of binary system are easy to express, simple operation rules and saving equipment. It is known that elements with two stable states (e.g., on and off of transistors, on and off of relays, high and low levels of electrical pulses, etc.) are easy to find, but it is difficult to find elements with 10 stable states corresponding to the decimal number 10.
1) The technology is simple, the computer is composed of logic circuits, logic circuits usually have only two states, switch on and off, these two states can be represented by "1" and "0". (2) Simplified operation rules: There are three combinations of two binary numbers and product operations, and the operation rules are simple, which is conducive to simplifying the internal structure of the computer and improving the operation speed. (3) Suitable for logical operations: logical algebra is the theoretical basis for logical operations. Binary has only two numbers, which coincides with "true" and "false" in logical algebra. (4) Easy to convert, binary and decimal numbers are easy to convert to each other. (5) Binary representation of data has the advantages of strong anti-interference ability and high reliability. Because each data has only two states, high or low, it can still be reliably distinguished when it is disturbed to a certain extent.
(3) Octal and hexadecimal appear why
Humans generally think in decimal, while computers are binary, but for programmers, they all need to deal directly with calculators if we are given a large number of binary numbers. Let's say a four-byte int: 0000 1010 1111 0101 1000 1111 1111 1111. I think any programmer who sees a string of zeros and ones like that would be very upset. So there has to be a more concise and flexible way to present this pair of data.
You may say, directly use decimal, if that is the case, it can not accurately express the computer way of thinking (binary), so there are octal, hexadecimal, in fact, hexadecimal more widely used, such as the above int data, directly converted to octal, 32./ 3 plus 2 means we have to add zeros in front of it, but converting to hexadecimal is different. 32/4=8, written directly as a string of 8 hexadecimal numbers, simple and clear.
So hexadecimal is undoubtedly the best way to express binary strings, which is why octal and hexadecimal are here.
(4) The problem of mutual conversion between bases
Common bases are binary, decimal, octal and hexadecimal
conversion between binary and decimal
decimal to binary
The method is as follows: decimal number divides by 2 to obtain remainder method, that is, decimal number divides by 2, remainder is the number on the weight position, the obtained quotient value continues to divide by 2, and the downward operation is continued until the quotient is 0.
(Specific usage as shown below)
binary to decimal
The method is as follows: the binary number according to the weight expansion, the addition namely obtains the decimal number.
(Specific usage as shown below)
conversion between binary and octal
binary to octal
The method is as follows: 3 binary numbers are expanded and added according to weight to obtain 1 octal number. (Note that 3-bit binary to octal conversion is from right to left, less than 0).
(Specific usage as shown below)
Octal to binary
The method is as follows: Octal numbers are obtained by dividing by 2 and taking the remainder method. For each octal system, there are 3 binary systems. When insufficient, zero is added to the leftmost side.
(Specific usage as shown below)
conversion between binary and hexadecimal
binary to hexadecimal
The method is: similar to the binary to octal method, octal is to take three in one, hexadecimal is to take four in one. (Note that 4-bit binary to hexadecimal conversion is from right to left, less than 0).
(Specific usage as shown below)
hexadecimal to binary
The method is as follows: hexadecimal numbers are obtained by dividing by 2 and taking the remainder method, and each hexadecimal system is 4 binary systems, and zero is added to the leftmost part when it is insufficient.
(Specific usage as shown below)
conversion between decimal and octal and hexadecimal
There are two ways to convert decimal to octal or hexadecimal.
First: indirect method-decimal to binary, and then from binary to octal or hexadecimal. No more pictures here.
Second: direct method-convert decimal to octal or hexadecimal by dividing by 8 or 16 until the quotient is 0.
(Specific usage as shown below)
Octal or hexadecimal conversion to decimal
Method: octal, hexadecimal numbers according to the weight of expansion, add that is, decimal numbers.
(Specific usage as shown below)
conversion between hexadecimal and octal
There are two ways to convert between octal and hexadecimal
The first is that they can be converted to binary and then to each other.
Second: conversion between them can be first converted to decimal and then converted to each other.
There is no need to explain the usage of pictures here.
The above is all the contents of this article "What is the way of data storage and operation in computers?" Thank you for reading! I believe that everyone has a certain understanding, hope to share the content to help everyone, if you still want to learn more knowledge, welcome to pay attention to the industry information channel!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.