当前位置:网站首页>Data storage 3

Data storage 3

2022-07-07 05:51:00 It's Yi'an

Part1:

With or without symbols operation Sleep(haomiao)(windows.h)for unsigned Cyclic sign change

character ’\0’

The operation with or without symbols is the same as the normal operation , The complement solves this problem , Make addition and subtraction unified . As long as it is not negative , With or without symbols , In the calculation process, only the scope problem and the output form problem can be considered .

Sleep() Dormancy function , Stop the program , Enter an integer representing milliseconds , stay Windows Header file .

Cyclic sign change , In a data type , No matter what number you enter , Its value will be in the range of this type . Such as 11111111+1=00000000, Start the cycle .

character ‘’\0’ In defining char of use = The assignment of number will be automatically followed by one , If you assign values to its elements one by one , Will not be automatically added , Use this time strlen() function , You will get a random value .

Part2:

floating-point %lf Scientific counting -1*s*M*2^E 1 8 23  1 11 52  E negative In the middle Take out E

Stored value True value E For zero  E For all 1

We talked about that before , use 0101010…… To store all the data , Different rules mean different data types , How to formulate these regulations , It's not what we're talking about now . The same is true for floating-point types , The rule is -1*S*M*2^E, Where, it represents positive and negative ,1 Negative ,0 Being positive .M It's valid data ,E Is the exponential size . Such as 3.5 Expressed in binary as 11.1, The scientific counting method is 1.11*10^1; be S=0;M=1.11,E=1. Knowing these three data, you can store it in memory .32 In a (float) Use the first place to express S, The last eight digits indicate E, because E May be a negative , So add a middle value 2^7-1(127), When we store, the real value plus the intermediate value is the stored value .M The form of must be 1,xxxx…, Because of all M At the beginning 1, Therefore, when storing . The problem of storage has been solved , There are still some points to pay attention to when taking it out .

Pay attention to put it in. We are right M and E Did something , Take it out in reverse , There are two special cases :

E It's all zero , It's true at this time E by -127, It's a very small value , So we directly stipulate E by 1- In the middle , and M No more filling when taking out 1, But make up 0.

E For all 1, It's true at this time E by 128, This time means infinity .

原网站

版权声明
本文为[It's Yi'an]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/02/202202130732431786.html