![]() ![]() 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. \sigma = 0.4324500847901426421787829374967964668614 In todays thrilling installment, the origins of one of the more famous snippets of graphics code in recent years is under the microscope Quake3s Fast InvSqrt (), which has been known to cause strong geeks to go wobbly in the knees while contemplating its simple beauty and power. Usefulness of the calculation is mostly given if you try to normalize a vector quickly. Alogrithm is taken from the game Quake III. A fast yet slightly inaccurate algorithm to calculate the inverse square root of a float number. The author derives a similar relation as above, but applied after the use of Newton's method, corresponding to A fast algorithm to calculate the inverse of a square root stolen from Quake III. 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. Int a, b // the fields of the return float Int E = (w > 23)
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |