An Expert Is actually By My Side

Chapter 100 Contestant No. 101 handed in the test early?

Chapter 100 Contestant No. 101 handed in the test early?

Compared to Academician Zhan Yongshu's astonishment, Hao Yun didn't think about it in a particularly complicated way when he was thinking about this problem. He just came up with this method when he was scratching his head.

The program first guesses a value close to 1/sqrt(number), and then uses Newton's iterative formula to perform iterative operations.

In terms of algorithm logic alone, in fact, the code after his rewriting is not much different from the code of the previous Q_Sqrt function. The Q_Sqrt function defined in the math.c file of Glacier Engine actually adopts this idea.

And the only difference is probably in that mysterious number - 0x5f375a86.

According to the principle of Newton's iterative algorithm, the closer the guessed value is to the final result, the fewer the number of iterations. The mysterious number 0x5f375a86 is used to calculate the guess value.

After several attempts, Hao Yun unexpectedly discovered that if the number "0x5f375a86" is used, the obtained y will be very close to 1/sqrt(n), so that when the Newton iterative algorithm is finally executed, only two substitutions are required. Get the precision he needs!

As for how this number is derived?

Hao Yun couldn't explain it either.

After all, he just followed his own mathematical intuition and felt that the number selected in the original program was not good enough, so he tried to change it to a more usable number.

At the beginning, he also tried several times, and found that the changed number was not as easy to use as the original number, until he had an idea and tried this 0x5f375a86, and found that only two iterations were needed to complete the entire calculation process.

To be honest, he himself was surprised.

possible……

This also has something to do with his mathematical attribute reaching proficiency?

All in all, after using the special number 0x5f375a86, the calculation efficiency of the whole function will be twice as fast as the Q_Sqrt function defined in the original math.c file in terms of the number of calculation steps alone!

As for the effect of this result...

To be honest, Hao Yun didn't have an accurate concept either.

After all, his understanding of this glacier engine is far from reaching the level of industry insiders.

Although he has made games before, in fact he only made 2048. Temple Escape can be regarded as using a development software with the same source as the Glacier Engine, but that game was basically completed by Li Zongzheng alone. Hao Yun did not participate in the development process at all, even if he participated in it, 80% would not The source code of the engine will be studied.

The game development tools in this world have evolved enough to be foolish enough. Except for those big productions, most small and medium-sized games can be realized purely by relying on development tools and a second-level programming level.

"...By the way, how much has the efficiency of the test engine been improved? Isn't there a scoring software or a game for testing on this computer?"

Hao Yun searched carefully on the computer, but he couldn't find any tool software that could be used to rate the engine, nor could he find a game that could test the performance of the engine.

In fact, the organizers did not prepare such a thing.

After all, from the very beginning, they never considered that someone could really complete this proposition.

"I'm going, is this a woolen business?"

After searching for a while, Hao Yun still couldn't find the detection tool, Hao Yun looked at the screen dumbfounded, completely lost.

You can't develop a game on the spot to run the score, right?

Although it is not impossible, but there is no material at hand, and the computer cannot be connected to the Internet. It is impossible to start from the most basic material, right?

After struggling for a while, Hao Yun finally gave up.

never mind.

Anyway, I can't think of a better optimization method...

Thinking of this, Hao Yun sighed, reached out and clicked the submit option in the test program, and then left the keyboard with both hands.

There is only a maximum time limit of three days for the exam, and there is no minimum time for handing in papers. You can leave the exam at any time after submitting your answers.

Because even if you submit the papers in advance, you will not get extra points, so even if you finish the papers in advance, most people will choose to wait until the meal time before handing in the papers, and go out to eat with friends who came to the competition together.

Hao Yun also planned this way at the beginning, but there was nothing in his cubicle, and he had nothing to do except sit and wait, so he had to come out of his cubicle.

When leaving the examination room, it was still the security guy standing at the security checkpoint.

Hao Yun glanced at him, and he also stared at Hao Yun for a while.

"To the bathroom? You're going in the wrong direction."

"No, I'm done."

"Exam, are you done?"

"Well," Hao Yun nodded, and pointed to the exit of the gymnasium, "Can I go out?"

Finally recovering from his stupefaction, the security guard Mu Mu nodded and untied the isolation belt blocking the entrance.

The Hope Cup two years ago was also held at Xiadong Normal University, and he was also standing here to maintain order. If he remembered correctly, the earliest examinee who handed in the papers at that time was also at five o'clock in the afternoon.

However, now, it is not an hour before the exam officially starts at nine o'clock...

Is this a blank paper?

At any rate, he is also a strong finalist selected from tens of thousands of works, so he won't hand in a blank paper, right? !

In fact, it wasn't just the security guards standing at the entrance of the examination room who were surprised.

The main examination committees standing in the background of the examination room were far more surprised than everyone here.

Especially Professor Zhang Cunhao.

After reading the code rewritten by Hao Yun, the whole person was dumbfounded.

Staring at the densely packed calculations on the draft paper, Professor Zhang Cunhao, who had calculated countless times in disbelief, finally couldn't help but swear.

"Fuck! How did this guy... come up with this number?"

this……

This is too incredible!

Just changing one guess number has doubled the operation efficiency of the entire function? !

Standing next to Professor Zhang Cunhao, Feng Zhengqing, the manager of the software development department of Longwei Group, quietly gave him a hand, and asked in a low voice, "How much efficiency can be improved if it is applied to the Glacier engine?"

"A conservative estimate of 20%, there are still quite a few related calculations for the inverse square reciprocal in the 3D engine..."

"Why are there so many?" Manager Feng was slightly moved.

As a layman, he doesn't know so many ways, and he doesn't know what is Newton's iterative algorithm, but he just thinks it's incredible!

Although the glacier engine is not the core research and development project of Longwei Group, there are definitely a lot of computer experts in the project team. However, so many people have not discovered this improvement method, but a student discovered it?

I can't believe anyone else!

Facing the full draft paper, Professor Zhang Cunhao was thinking hard, although he gradually felt that this thing was beyond the research field he was familiar with.

Standing next to him was an old professor from the Capital National Defense University. After being silent for a long time, the old professor also expressed his sincere emotion.

"Unbelievable...I didn't expect this guy to find a breakthrough where it was the least likely to find a breakthrough. I always thought that the functions in the math.c file were perfect enough, just like addition, subtraction, multiplication and division, these tools can be used directly. I never thought there would be such a miraculous method that can make the boundary of perfection go one step further.”

"This kid is a talent!"

Not knowing what was going on in his heart, Professor Zhang Cunhao's silent expression suddenly showed a trace of entanglement.

After struggling for a long time, he looked at his teacher, Academician Zhan Yongshu.

"But with all due respect, is such an answer really okay?"

Academician Zhan Yongshu glanced at him.

"Are you still not convinced?"

"I'm not unconvinced, I just feel...a bit aggrieved," Professor Zhang Cunhao held back for a long time before speaking out, "This is not a solution in the sense of a program at all, and he didn't even modify a single line of code at all. .Anyone can see that...this is nothing but mathematics!"

Yes, it's just math at all!

That contestant just modified a random number, which happened to reduce the number of Newton iterations in the underlying function that calculates the "reciprocal of the inverse square", and then optimized the engine by "accumulating less and more"?

After all, why is it this number? !

After all, he is not a mathematician, so Zhang Cunhao almost collapsed and didn't think about it.

Looking at the maddened student, Academician Zhan Yongshu suddenly smiled.

"Who said it wasn't?"

He didn't even think about how this number was calculated, and it was the kind that he had no clue at all.

Rely entirely on intuition?

Similar situations are not unheard of. In fact, some mathematical constants were guessed based on experience at the beginning, and the mathematical principles were not proven until more than ten years or even centuries later.

Thinking of this, academician Zhan Yongshu couldn't help feeling softly in his heart when he looked at the candidate who was leaving the examination room.

possible……

That's genius.

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

You'll Also Like