Yes, I think I used that algorithm in some of my projects (without understanding it 😅) but I'll fully learn it next time I need it. And there is a famous yt video "quake fast inverse square root" or smth about it aswell.
Good question, quickly looking at the pow() function implementation of muslibc, it is waaaayy more complex than my implementation (theirs is ~350 lines long 😅) but they are dealing with floating point numbers instead of integers so I'm sure a lot of the complexity comes from there.
If you are interested in the subject and do not know it yet.
I recommend you to learn about fast inverse square root, it's really impressive.
Yes, I think I used that algorithm in some of my projects (without understanding it 😅) but I'll fully learn it next time I need it. And there is a famous yt video "quake fast inverse square root" or smth about it aswell.
Does the math pow() function also use this approach or is there even better solution?
Good question, quickly looking at the pow() function implementation of muslibc, it is waaaayy more complex than my implementation (theirs is ~350 lines long 😅) but they are dealing with floating point numbers instead of integers so I'm sure a lot of the complexity comes from there.