Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
Fast Inverse Square Root (wikipedia.org)
6 points by WhiteDawn on April 1, 2014 | hide | past | favorite | 3 comments



For a second I was expecting this to be an April Fool's post about a "fast" way to calculate the inverse of the square root function, i.e. x*x :-)


A lot of times, the code you are writing does distance comparisons to determine overlap or intersection. But if all you are doing is this, then you can use the square of the distance which is just x^2 + y^2 and you have no need for a square root. Some mathematicians call this "quadrance". Or just do all your work in this metric and reserve the square rooting for when it is absolutely necessary.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: