Font
Large
Medium
Small
Night
Prev Index    Favorite Next

Chapter 1268 Save Space

Chapter 1268 Saving Space

No wonder Joan didn't know.

Floating-point arithmetic was invented after the computer developed for a period of time to improve its flexibility and computing range in response to limited storage space.

At this time, Joan and Turing were still far away. Although they had enough IQ to invent this kind of operation, their attention at this time was mainly focused on "Christopher" itself, and mainly on its use in decoding.

So I didn't take this into consideration.

"Let's put it this way!" Wang Xuexin led a few people to the desk next to the air-raid shelter door. He took the paper and pen on the table and explained while writing: "If we use 16-bit operations on data with decimals, as usual

The calculation method should be to allocate half of the storage unit, that is, 7 bits to the integer, and the other 8 bits to the decimal, right?"

"That's right!" Joan nodded.

The reason why there are only 7 integer bits is because the data is usually positive or negative, and one bit is left open to indicate positive and negative (0 means positive, 1 means negative), this bit is also called the sign bit.

"Such a storage method often wastes space and time!" Wang Xuexin continued: "Its fixed integer digits are only 7 digits and the decimal digits are only 8 digits. If there is data 123456678, although it only has 8 digits,

We have 16 storage units, but we can’t hold that number!”

This is because there are only 7 integer digits, so an eight-digit number has exceeded its storage range, even though the 8 storage units of the decimal place do not store a single digit.

In the same way, if there is no digit in the integer digit but the decimal digit is in the ninth digit, it cannot be effectively stored for calculation.

Qiong nodded and said: "This is what I want to say, we should expand to 32 storage units. It was difficult to do this with mechanical parts before. Now we use relays to make parts. The same conditions can fully achieve 32-bit

Why not do it?”

"Wait a minute, Qiong!" Wang Xuexin said, "Listen to me first!"

Joan nodded and then stopped talking.

Wang Xuexin continued: "This is a traditional storage method. Let's call it fixed-point arithmetic. Floating-point arithmetic means that we use several of them, such as four, to store powers..."

"Storage powers?" Qiong looked at Wang Xuexin in surprise: "But they usually don't have powers!"

Chen and Ban were also puzzled. They didn't understand what the use of such a switch would be.

Wang Xuexin gave an example: "For example, the data 12345678 just now, why can't we turn it into 1.23456678 times 10 to the 7th power? Then our storage space for integers and decimals can be used at will. Simply put, there is no decimal

The used storage space can be converted to integers using this method, and the unused storage space for integers can be converted to decimals for use!"

Qiong couldn't help but suddenly realized.

"That's right, Comrade Leader!" Qiong said: "In this way, our storage space has 11 digits at any time, and we can store any 11-digit number instead of the 7-digit integer or 8-digit decimal number of fixed-point arithmetic.

.”

"Yes!" Wang Xuexin nodded and said: "Actually, if we convert it to binary and convert all the numbers into the form of 1.XXXX and only store the numbers after the decimal point, we can store one more

That’s 12 bits!”

This is a bit difficult to understand.

The reason why one more digit can be stored is because the number in binary is either 0 or 1, and the first digit is always 1... If the first digit is 0, there is no need to write it out, just like an integer in decimal.

There cannot be zero in front of it.

If the first bit is always 1, then there is no need to waste a space to store it in the storage unit, so a storage unit is saved to maximize the utilization of the storage unit.

When it comes to calculations, what you need to do is not to miss the "1" that has not been stored... Modern programming calculations can add "1" to the calculation in the program, and the calculations in this period are between storage units.

Connect a few more wires to add some carry rules.

Wang Xuexin then said: "To be exact, there are more than 12!"

Qiong was stunned for a moment, and then she understood immediately. Her eyes widened and she nodded repeatedly: "Yes, it's not just 12! It should be..."

Qiong thought for a moment and said excitedly: "In extreme cases, it should be 20, right? Comrade leader!"

Wang Xuexin nodded. Qiong was indeed Qiong, a mathematician on whom the sun never sets. She immediately knew that another benefit of moving the decimal point was that it could also increase the accuracy of calculations.

For example, a data is 0.00000001111111111111. Fixed-point arithmetic cannot store this number, but floating-point arithmetic only needs to change it into 1.111111111111. Then move the decimal point by a certain number of places and store it in the power storage unit. 12 storage units can just store this number.

Save the numbers and perform operations.

To put it bluntly, this is actually binary scientific notation, but we have to find a way to accurately store the data into a limited space, so we have seven, seven, eight, eight, and eight extra spaces and digits.

Ban and Chen were a little confused when they heard it, but when they saw Qiong's excited face, they knew that Wang Xuexin was right, but they just didn't understand.

However, Wang Xuexin is not worried in this regard, because Ban and Chen are just not used to binary calculations and are not used to connecting it with the computer's storage unit, so they are half-understood and not very clear.

"That's great, Comrade Leader!" Qiong hugged Wang Xuexin excitedly and said, "This method allows us to improve the accuracy and range of operations without adding more storage units. It's incredible. How did you come up with this method?

?”

"This..." Wang Xuexin glanced at Ban and Chen with some embarrassment, and replied: "This is... you know, we encountered this problem when we were developing computers. In order to reduce the failure rate as much as possible, we

We can only try our best to reduce parts!”

Wang Xuexin’s explanation is reasonable.

The more parts, the higher the failure rate, and conversely, the fewer parts, the lower the failure rate.

The Eighth Route Army's industrial level was not good enough and the parts failure rate was high, so it had to find ways to reduce parts to reduce the failure rate, so it had to use its brains on algorithms.

But of course, none of this happened, they were just made up by Wang Xuexin.

Wang Xuexin knows this, but he is just taking advantage of modern people.

Sometimes Wang Xuexin wonders, if he can learn these things, can he also use the C language he learned in college?

But when you think about it, you know it's impossible. Computers had just come out at this time, and they used low-level languages ​​or even no low-level languages. They needed to be controlled manually...

Things like C language are definitely not useful.
Chapter completed!
Prev Index    Favorite Next