Unfortunately, the exact method by which the constant used in Quake III was derived appears to be lost to time, though there appears to have been some trial and error paired with theory. This is more accurate than the original, and the author continues by giving refinements for double and quadruple precision. Which gives the constant as 0x5f375a86, for a maximum relative error of 0.0017512378. The author derives a similar relation as above, but applied after the use of Newton's method, corresponding to However, this ignores the fact that we will be using Newton's method, which will perform better for an underestimate than the actual answer. He then creates an expression of the relative error of each constant and shows that the mantissa Where x is the mantissa of our input and t is the mantissa of the constant for which we are searching. First, the exponent is shown to be 190, and the mantissa of the constant minus our bit shifted number as the following: Now, we generalize this idea to work for any constant. Carmack, Id Software, Quakec, Quake II, Quake III Arena, Trent Reznor, Fast Inverse Square Root, Quake 4, Id Tech 3, John Romero by LLC. Int a, b // the fields of the return float Int E = (w > 23)
0 Comments
Leave a Reply. |