Bright Sword Military System

Chapter 1268 Save space

Chapter 1268 Save Space
No wonder Joan didn't know.

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

At this time, Joan still has Turing, who is far away from the sun. Although they have enough IQ to invent this calculation, but at this time their attention is mainly focused on "Christopher" itself, and mainly for its decoding purposes. So this was not taken into account.

"Let's put it this way!" Wang Xuexin brought a few people to the desk next to the door of the air-raid shelter, took the paper and pen on the table and explained while writing: "If we use 16-bit arithmetic with decimal data, according to the conventional The calculation method should be to allocate half of the storage units, that is, 7 bits, to integers, and the other 8 bits to decimals, right?"

"That's right!" Joan nodded.

The reason why there are only 7 integer bits is because the data usually has positive and negative, and one bit is left to indicate positive or 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 integer digits are fixed at only 7 decimal digits and only 8 digits are fixed. If there is a data that is 123456678, although it only has 8 digits and We have 16 memory cells, but we can't hold that number!"

This is because there are only 7 integer bits, so an eight-digit number has exceeded its storage range, although none of the 8 storage units of the decimal place has a single number.

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

Joan nodded and said: "That's what I want to say. We should expand to 32 storage units. It was very difficult to do this with mechanical parts before, but now we use relays as parts. The same conditions can completely achieve 32 bits. Why not?"

"Wait, Joan!" Wang Xuexin said, "Listen to me first!"

Joan nodded and fell silent.

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

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

Chen Ban and the two were also puzzled, they didn't understand the use of such a switch.

Wang Xuexin gave an example: "For example, the data 12345678 just now, why can't we turn it into 1.23456678 multiplied by 10 to the 7th power? Then our storage space for integers and decimals can be used at will. Simply put, decimals have no The used storage space can be converted to an integer using this method, and the unused storage space of the integer can be converted to a decimal for use!"

Joan couldn't help but suddenly realized.

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

"Yes!" Wang Xuexin nodded and said, "Actually, if we convert it to binary and convert all the numbers to 1.XXXX and only save the numbers after the decimal point, we can save one more digit." That's 12 digits!"

This is a bit difficult to understand.

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

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 needs to be done is not to omit the "1" that has not been stored...Modern programming calculations can add "1" to the program, and the calculations in this period are between the storage units Connect a few more wires to add some carry rules.

Wang Xuexin went on to say: "To be precise, there are not only 12!"

Joan was taken aback for a moment, and then she understood immediately, her eyes widened and she nodded repeatedly: "Yes, there are more than 12! It should be..."

After thinking for a while, Joan said excitedly: "In extreme cases, it should be 20, right? Comrade leader!"

Wang Xuexin nodded. Joan is indeed Joan, a mathematician whose sun never sets. She immediately knew that another benefit of moving the decimal point is that it can also increase the accuracy of calculations.

For example, if a data is 0.00000001111111111111, the fixed-point calculation cannot store this number, but the floating-point calculation only needs to change it to 1.111111111111, and then move the decimal point to the power storage unit, and 12 storage units can just store this Store the numbers and perform calculations.

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

Ban and Chen were a little confused, but seeing Joan's excited face, they knew that Wang Xuexin was right, but they didn't understand.

However, Wang Xuexin was not worried about this, because Ban and Chen were just not used to binary calculations or linking it with the storage unit of the computer for a while, so they didn't understand it very well.

"Great, Comrade Leader!" Joan hugged Wang Xuexin excitedly, and said: "This method allows us to improve the calculation accuracy and calculation range without adding storage units. It's incredible. How did you come up with this method? ?”

"This..." Wang Xuexin looked at the two of Ban 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 there are, the higher the failure rate. Conversely, the fewer parts, the lower the failure rate.

The Eighth Route Army's industrial level is not good enough and the failure rate of parts is high, so we must try our best to reduce the number of parts to reduce the failure rate, so we have to use our brains on the algorithm.

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

Wang Xuexin knew this, but he just took advantage of modern people.

Sometimes Wang Xuexin wonders, if all these can be used, then can he also use the C language he learned in college?

But if you think about it, you know it's impossible. At this time, computers have just come out, and they use low-level languages, even without low-level languages. Manual connection control is required...

Something like the C language is definitely not available.

(End of this chapter)

Tap the screen to use advanced tools Tip: You can use left and right keyboard keys to browse between chapters.

You'll Also Like