MillionNovel

Font: Big Medium Small
Dark Eye-protection
MillionNovel > An Expert Is actually By My Side > Chapter 100

Chapter 100

    Compared with Academician Zhan Yongshu''s surprise, Hao Yun didn''t think about it when he thought about it. It was just a brainwave when he scratched his head.


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


    Just from the logic of the algorithm, in fact, his rewritten code is the same as the previous Q_ The code for the sqrt function doesn''t make much difference. Q defined by glacier engine in math. C file_ Sqrt function, in fact, also uses this idea.


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


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


    After several attempts, Hao Yun unexpectedly found that if he used the number "0x5f375a86", the obtained y would be very close to 1 / sqrt (n), so that when he finally implemented the Newton iterative algorithm, he only needed two iterations to achieve the accuracy he needed!


    How did you get this number?


    Hao Yun can''t explain.


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


    At the beginning, he tried several times and found that the changed number was not as easy to use as the original one. Later, he got an idea and tried this 0x5f375a86. He found that it took only two iterations to complete the whole calculation process.


    To be honest, he was not surprised.


    Maybe


    Does it have something to do with his mastery of mathematics?


    In a word, after using the special number of 0x5f375a86, the operation efficiency of the whole function will be higher than that of Q defined in the original math. C file_ The sqrt function is twice as fast!


    As for the effect of this result


    To be honest, Hao Yun does not have an accurate concept.


    After all, his understanding of this glacier engine is far from that of the industry.


    Although he had played games before, he only played 2048. Temple Escape is a kind of development software with the same origin as glacier engine, but that game was basically completed by Li Zongzheng alone. Hao Yun didn''t participate in the development at all. Even if he participated in it, he would not study the source code of the engine.


    The game development tools in this world have evolved to a fool''s degree. Apart from those big productions, most of the small and medium-sized games can only be realized by relying on development tools and secondary programming level.


    "... in other words, how much has the efficiency of the test engine been improved? Is there no scoring software or testing game on this computer? "


    Hao Yun searched the computer carefully, but he didn''t find the tool software that can be used to score the engine, nor the game that can test the performance of the engine.


    In fact, the organizers did not prepare such things.


    After all, from the beginning, they didn''t even consider that someone could really complete this proposition.


    "I''ll go. Is it wool?"


    After searching for some time, we still can''t find the detection tool. Hao Yun looks at the screen with tears and smiles, and there''s no way out.


    Can''t you develop a game on the spot to run points?


    It''s not that bad, but I don''t have any material at hand, and computers can''t be connected to the Internet. I can''t start with the most basic material, can I?


    After some entanglement, Hao Yun finally gave up.


    forget it.


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


    Thinking about this, Hao Yun sighed, reached for the submit option in the examination program, and then left the keyboard with both hands - the so-called AK.


    The examination only set a three-day maximum time limit, and did not set a minimum time to hand in papers, submitted answers can leave at any time.


    Because even if you hand in the paper ahead of time, you won''t get extra points, so even if you finish it ahead of time, most people will choose to cook until dinner time to hand in the paper, and go out to dinner with the friends who come with you.


    Hao Yun planned to do the same at the beginning, but there was nothing in his compartment. He had nothing to do except sit and wait, so he had to come out of his compartment.


    When I left the examination room, the security guard was still standing at the entrance.


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


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


    "No, I finished."


    "Test, finished?"


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


    Finally, he recovered from the stupefied spirit. The security guard''s little brother Mu lowered his head and untied the isolation belt at the entrance.


    Two years ago, the hope cup was also held in Xiadong Normal University. At that time, he also stood here to maintain order. If he remembers correctly, at that time, the earliest examinee to hand in the examination paper was at five o''clock in the afternoon.


    Now, however, it''s not an hour before the exam officially starts at nine o''clock


    This is special. Did you hand in the blank paper?


    At least, it''s also a finalist from tens of thousands of works, so it won''t turn in the blank?!


    In fact, it''s not just the security guys standing at the entrance of the examination room who are surprised.


    Standing in the background of the examination room, the main examination committee is far more surprised than everyone here.


    Especially Professor Zhang cunhao.


    After reading Hao Yun''s rewritten code, the whole person was stupid.


    Staring at the dense formulas on the draft paper, Professor Zhang cunhao, who had done countless calculations in disbelief, finally burst into a rude sentence.


    "The trough! How did this guy... Come up with this number? "


    This


    This is too unthinkable!


    Just changing a guess makes the efficiency of the whole function double?!


    Standing next to Professor Zhang cunhao, Feng Zhengqing, manager of Software Development Department of Longwei group, quietly gave him a hand and asked in a low voice, "how much operational efficiency can be improved if it is used in Glacier engine?"


    "The conservative estimate is 20 percent, but there are still a lot of operations related to inverse square reciprocal in 3D engine..."


    "Why so much?" Manager Feng was slightly moved.


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


    Although glacier engine is not the core R & D project of Longwei group, there are many computer giants in the project group. However, so many people did not find this improvement method, but was found by a student?


    No one can believe it!


    Professor Zhang cunhao is pondering over the paper, although he has gradually felt that it is beyond his familiar research field.


    Standing next to him was an old professor from capital National Defense University. After a long silence, the old professor also expressed his sincere feelings.


    "Incredible... I didn''t expect this guy to find a breakthrough in the most unlikely place. I always thought that the functions in math. C were perfect enough, just like the tools of addition, subtraction, multiplication and division. I didn''t expect that there was such a magic way to make the perfect boundary go one step further. "


    "This boy is a talent!"


    I don''t know what is on my mind, but Professor Zhang cunhao''s silent expression suddenly floats a tangle.


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


    "But with all due respect, is that really a good answer?"


    Academician Zhan Yongshu took a look at him.


    "Are you not convinced?"


    "I''m not unconvinced. I just feel a little bit aggrieved," Professor Zhang cunhao said after a long time. "It''s not a solution in the sense of program at all. He didn''t even modify a line of code at all. No matter who you are, you can see that it''s mathematics


    Yes, it''s mathematics!


    That contestant just modified a random number. As a result, it happened that the underlying function for calculating "inverse square reciprocal" did a few less Newton iterations, and then the engine was optimized in this way?


    After all, why is it this number?!


    After all, he is not a mathematician. What Zhang cunhao thinks is going to collapse, and he doesn''t think of it.


    Looking at the students with crazy faces, academician Zhan Yongshu suddenly laughed.


    "Who said no?"


    He didn''t know how to calculate the figure, and he didn''t have any clue at all.


    Totally intuitive?


    It is true that there have been similar cases. In fact, some mathematical constants were first guessed by experience, and the mathematical principles were not proved until more than ten years or even several centuries later.


    Thinking of this, looking at the examinee who is leaving the examination room, academician Zhan Yongshu can''t help feeling in his heart.


    Maybe


    That''s genius.
『Add To Library for easy reading』
Popular recommendations
A Ruthless Proposition Wired (Buchanan-Renard #13) Mine Till Midnight (The Hathaways #1) The Wandering Calamity Married By Morning (The Hathaways #4) A Kingdom of Dreams (Westmoreland Saga #1)