ArticleDirectory
- 2.1 What is a number?
- 2.2 counting system
- The number of 2.3 and string representation
- Internal representation of 2.4 numbers
I have read a good book. Today, the Library has read the first volume: Understanding the machine.
This explains the underlying details of the computer, which fills the gaps in many programming books in the world.
Indeed, to better understand this, you can read a thick book. I have read it and I like it very much.
But when we started to teach us about the great socialist education, there were several people who taught you why it was like that!
For example, when you were in college programming, a teacher told you what problems the operating system has helped you solve,ProgramHow do I interact with the operating system? Do you know how to layout the runtime inner layer? How do you know what the Runtime Library has done? Is the C standard library portable? Even you know what the compiler has done behind it? What do you know?CodeIt is portable. Which codes are machine-related or system-related? If there is no operating system or compiler, how can you let the computer help you? Wait... we are sad. We know it, but we don't know why... they created rules!
Let others go to college to learn the things they should go to. I advertised my love for the poor, so I chose a language that is not between advanced and low-level languages: c/C ++. Maybe when I really want to expand my computer's control, I may look down on assembly. Even one day, I simply used machine code to write code... haha, this is a little regressing. But what else is more satisfying than full control?
Books are the ladder of human progress, right?
Ranall HYDE: this person is very good. The author of the following books recommended Assembly: high level assembly.
<The Art of Assembly>
Http://webster.cs.ucr.edu/AoA/index.html
<Write great code>
Http://webster.cs.ucr.edu/WriteGreatCode/index.html
Chapter 2 numeric representation2.1 what is a number?
Quantity: Number
One of a series of symbols of unique meaning in a fixed order that can be derived by counting.
Number: Digit
Such a symbol used in a system of numeration.
- The number is usually a symbolic sequence.
- The expression of numbers is not unique.
2.2 counting system
- Positional notation system: compact and easy to recognize
- Non-positioanal notation system
Common Non-bit value counting:
Tally-slash:
25:
The Chinese election vote "positive:
13:
The following describes a common bit value counting system:
2.2.1 decimal 2.2.2 base (base) 2.2.3 binary
Convert binary to decimal:
110010102:
1x107 + 1x106 + 0x105 + 0x104 + 1x103 + 0x102 + 1X101 + 0x100
20210
Convert decimal to binary:
Non-stop division. The operator is an even number, and the operator is an odd number. The operator is 1.
8410
10101002
2.2.4 hexadecimal count
Advantage: it is more compact than binary and easy to convert from binary
The hexadecimal and binary conversion methods are grouped by 4-bit
Octal and binary conversion methods are grouped by 3bit
The number of 2.3 and string representation
Consider the following:
Generally, we need an integer. The user inputs a string from the console. How can we get the number of Integer Variables?
The run-time library is used to convert characters into the internal binary format required by the CPU.
You need to know that this conversion requires a price. The specific conversionAlgorithmNot discussed here
Conversion between strings and numbers is involved in any of the following processes:
Printf ("% d", I); // C
Cout <I; // C ++
Internal representation of 2.4 numbers
2.4.1 bit
2.4.2 Bit String
Half-byte nibble: 4 bits
Byte: 8 bits
Word: the word is dependent on the CPU, and the machine word 80x86 is 16 bits.
Dual-word DWORD: 80x86 CPU is 32 bits
Long word: 80x86 CPU is 64 bits
Tbyte: 10 bytes, used to store Extended Floating Point Numbers and BCD numbers