4 ms·
I really want to see it explain the famous Quake fast inverse square root, but apparently it's extremely rate limited right now
by juliansimioni 4y ago
I really want to see it explain the famous Quake fast inverse square root, but apparently it's extremely rate limited right now
- flurly 4y agoShould be back up... for now!
- jurimasa 4y agohttps://whatdoesthiscodedo.com/g/565aad7 https://whatdoesthiscodedo.com/g/565aad7
- recuter 4y agoThe specific operations involve subtracting the integer value from a predetermined constant (0x5f3759df), shifting it right by 1, converting it back to a float, and then performing one iteration of a Newton-Raphson approximation using the threehalfs constant and the original input value. There is also a commented-out line for performing a second iteration, but it is not necessary for most use cases. So this is actually the perfect counter example to all the other "impressive" ones as this particular explanation can't be derived from a pure reading of the code. It correctly recognized what it was given as the quake inverse square root algorithm and plagiarized bits of the explanation thus sounding l33t! Still, very useful.
- archgoon 4y ago[dead]
- voxelghost 4y agoIt is interesting to see what happens when we rename the function and all the variables. https://whatdoesthiscodedo.com/g/9f22a12 https://whatdoesthiscodedo.com/g/9f22a12 The code defines a function called "myfunc" that takes a single input parameter n of type float and returns a value of type float. The function performs some numerical operations on the input value in order to calculate an output value. First, the input value is multiplied by 0.5 and stored in a variable called y. The input value itself is also stored in a variable called z. Next, the function does some bit manipulation using pointers to convert the value of y from a float to a long integer, perform some bitwise operations on it, and then convert it back to a float. This step is not immediately clear what it's doing without knowing the specific algorithm being used. Finally, the function calculates a new value for z using the original input value n, the modified value of y, and a constant value called tihihi. The exact formula used to calculate the new value of z involves multiplying a term that depends on y and n by a constant value tihihi, and then multiplying the result by the modified value of z. Overall, the purpose and meaning of this code is not immediately clear without additional context or knowledge of the specific algorithm being implemented. In this way we can sort of gleam what part of the understanding comes from the AI encountering that code snippet before, and what part comes from a more fundamental understanding.
- recuter 4y agoExactly.
- zzo38computer 4y agoThe explanation isn't very elaborate, e.g. it does not explain why it uses that specific constant number.