1. Basic concepts

Truth value ：+0101,-0100; Number of machines ： [x] primary =0101

2. Several machines

Original code ：x = -0101,[x] primary = 1101

Inverse code ：x = -0101,[x] back = 1010

Complement code ：x = -0101,[x] repair = 1011

Shift the code ：x = -0101,[x] move = 2^n + x = 0011

PS： Let's talk about our understanding of complement and shift . Complement is to reduce subtraction to add for the convenience of computer design and operation , Code shifting is for the convenience of size comparison , Used in the order code of floating-point numbers .

Complement code —— In any modular system , Subtraction can be expressed by adding its complement . The simplest example is 12 A watch for a model , For example, now it is 3 spot , that -5 Hours Is equal to +7 Hours , All are 10 spot . here 7 Namely 5 Complement .

Shift the code —— Data correspondence moves one position at a time , Make the number that looks small really small . Like the original 0000 Express 0, Now it means -128, then 0001 Express -127, Until 1111 Express +127, This is convenient for comparison .

3. Fixed point number and floating point number

Fixed-point number ： Fixed decimal point x.xxxxxx, Indicates that the scope is limited , Forget it

Floating point numbers ： The range and precision of numbers are expressed respectively .

General format ：EEEE......EMMM.......M,E Part of it is Order code （ The range of numbers i）,M Part of it is mantissa （ The precision of numbers ）. shortcoming ： Order code and mantissa digit are not fixed , Too flexible.

IEEE754 Format ： Come back with me ----

32 It is （ Single precision ）：1 Bit sign bit S + 8 Skewness index E + 23 Bit effective mantissa M, The offset value is 127.

64 It is （ Double precision ）：1 Bit sign bit S + 11 Skewness index E + 52 Bit effective mantissa M, The offset value is 1023.

It's worth it （32 Position as an example ） N = (-1)^S * 2^(E-127) * 1.M

The special case of floating-point numbers

E=0,M=0： Machine zero

E=255,M=0： infinity , Corresponding to x/0

E=255,M!=0： Non numerical NaN, Corresponding 0/0

ps： Attach a copy of IEEE754 file ：https://files.cnblogs.com/files/flashsun/7542008-2008.pdf

4. data verification

The basic principle ： Add redundancy code

Yardage ： The minimum number of different binary digits between legal codes

Code spacing and error detection 、 Error correction ability

Yardage d>=e+1： Check e A mistake

Yardage d>=2t+1： correct t A mistake

Yardage d>=e+t+1： Check at the same time e A mistake , And correct t A mistake .（e>=t）

PS： Here's my understanding , Increasing the code spacing is to increase the number of illegal codes , It's OK to see illegal code A mistake has been detected , And the illegal code distance which legal code is more advanced thinks what should be right （ Simple understanding , Please refer to the figure below ）, That is, yes Correct mistakes . I've seen a good understanding of geometry here , Savor carefully ：

for instance ： Let's say there are 8 position , The code distance is 1 Then check no mistakes , Because all codes are legal . If the code distance is 2, That legal code should look like 00000000,00000011,00001100,00001111 such , Then if there is 00000001 Such illegal coding is wrong , A dislocation can be checked , But if two people are wrong at the same time , Then it's possible to jump to another legal code , I can't find out 2 Dislocation .

Then if the yard distance is 3, That legal code should look like 00000000,00000111,00111000,00111111 such , So if there's a dislocation 00000001, Or two dislocations 00000011, It's all illegal code , Can check out mistakes , And right now 00000001 by 00000000, correct 00000011 by 00000111. But if three people are wrong at the same time, they can't be checked out .

Common verification strategies ： Parity check ,CRC check , Hemingway check

ps： Hemingway coding the strongest video demonstration course ：https://www.youtube.com/watch?v=373FUw-2U2k

## 【 Learn computer again 】 Group counting D2 Chapter ： More articles on data representation

1. 【 Learn computer again 】 operating system D2 Chapter ： Processor management

1. Instruction and processor mode Command execution cycle : Fingering . decoding . perform Instruction classification ( According to authority ) Privileged orders : Can only be used by the operating system kernel ( start-up IO, Set up PC value ) Non privileged instructions : All programs can use Processor mode : There are four kinds of :0 Kernel mode , ...

2. 【 Learn computer again 】 operating system D3 Chapter ： Storage management

1. Basic concepts of storage management Logical address : Address of the user , Number from zero One dimensional logical address :( Address ) Two dimensional logical address :( Segment number : Segment address ) The reuse of main memory By zone : Main memory divided into multiple fixed / Variable partition , A program occupies a partition Press ...

3. 【 Learn computer again 】 operating system D1 Chapter ： Overview of computer operating system

1. Computer software and hardware system Von Neumann structure With the arithmetic unit as the core , The control flow is generated by the instruction flow Programs and data are stored in main memory Main memory is accessed by address , Linear addressing The instruction consists of an operation code and an address code Data is encoded in binary other : Reference resources < Learn computer again ...

4. 【 Learn computer again 】 Crew D4 Chapter ： The storage system

1. Storage system hierarchy The reason why main memory is slow : Main memory growth and CPU Out of sync , Access main memory multiple times during the execution of instructions The reason for the lack of main memory capacity : There are technical factors restricting the main memory capacity : Such as by CPU. The main board and other relevant technical indicators stipulate the main memory capacity Application to main memory ...

5. 【 Learn computer again 】 operating system D4 Chapter ： Equipment management

1. IO Control mode of Evolution : polling --> interrupt --> DMA --> IO passageway Classic layout : North South Bridge PS: See < The principle of computer organization > 2. IO The implementation of the Software implementation level : Hardware ...

6. 【 Learn computer again 】 Crew D8 Chapter ： I / O system

1. I / O System Overview form : peripherals . Interface . Bus . Management software Basic function Complete the information transfer inside and outside the computer Guarantee CPU Choose the output device correctly Use buffer etc , Realize the speed matching between the host and the peripheral characteristic : asynchrony . The real time . Device independence Entered ...

7. 【 Learn computer again 】 Crew D7 Chapter ： Bus

1. Characteristics and application of system bus Bus concept : Connect the parts of the computer system Bus classification :( external / Inside , System / Non system , Serial / parallel , Sync / asynchronous ...) By use : Storage bus :cpu And memory The system bus : Connect the storage bus ...

8. 【 Learn computer again 】 operating system D6 Chapter ： Concurrent programming

1.  The basic concept of concurrent program Sequence of procedures Internal order :CPU Execute instructions strictly in order External order : Programmers often use the idea of sequential design when designing programs Sequential program features The sequence of program execution The closeness of the computing environment : When a program is executed, it is like monopolizing resources ...

9. 【 Learn computer again 】 operating system D5 Chapter ： file system

1. file system File System Overview Organization of documents : Logical structure : streaming . Recording Physical structure : The order . Connect . direct . Indexes Access to documents : The order . direct . Indexes Control of documents : Logic control . Physical control The use of documents : open . close . read . Write . control ...

## Random recommendation

1. WCF Service ABC The address of （ 5、 ... and ）

Address Address stay WCF in , Each service has a unique address (Address). The address contains two important elements : Service location and transport protocol . The service location contains the target machine name . Site . Communication port . The Conduit ( Or a line ), And an optional feature ...

2. Redis Learning manual ( The sample code )

In the previous blog has been very detailed introduction Redis All kinds of operation orders . Operation mechanism and server initialization parameter configuration . This blog is the last in the series , In this paper, we will give an example based on Redis Client components access and operate Redis Server code example . ...

3. nginx_http Core module ( Two )

Explain some common configuration items : Please see the official document for details :http://nginx.org/en/docs/http/ngx_http_core_module.html 1. alias Syntax: ali ...

4. jquery newly added , Delete , modify , Empty select Medium option

jQuery obtain Select Select the Text and Value: 1. var checkText=jQuery("#select_id").find("option:selec ...

5. see linux The system version is 32 A still 64 position

How to view ubuntu The version is 64 A still 32 Bit : 1.# uname -a If there is x86_64 Namely 64 Bit , No is 32 Bit 2.# uname -mx86_64 3.# archx86_6 How to view u ...

6. python Calculate the number of months between the two dates

In the near future , Because the business needs to calculate how many months before the two dates differ . I've been looking online for a long time , It turns out that everything python, There is no module to calculate the months of two dates , image Java.C# High level languages like that , There will be (date1-date2).mo ...

7. JDK Common commands （ Two ）jstack

Dump Dump A file is a memory mirror of a process . You can save the execution state of a program to dump In file .Dump Files are generally used for driver writers to debug drivers , stay java Used to analyze the stack information of the running program in memory ...

8. Systemd Initialization process /RHEL 6 In the system System V init Command and RHEL 7 In the system systemctl Comparison of orders

Linux The boot process of the operating system is like this , From BIOS Start , Then enter Boot Loader, Reload the system kernel , Then the kernel initializes , Finally start the initialization process . Initialize the process as Linux The first process of the system , It needs to be done Li ...

9. Python Detection of file coding in

Preface : The principle of file opening is “ In what encoding format , Just open it in whatever encoding format ”, Our common files are usually in the form of “ utf-8 ” or “ GBK ” Code to save , Because the editor generally sets the default save and open mode , So we are ...

10. vue Components - Pass value from parent to child

The parent component uses properties , Pass value to subcomponent , Subcomponent pass ,props Array to accept the value passed by the parent component . HTML part : <div id="app"> <tmp1 :parent ...