Skip to content

Comment on Fast Inverse Square Root

Comments

i've seen this multiple times in the past few years, each time i've seen it i've understood just a tiny bit more... i would love to see an interview with the original author of this...

my impression (from reading the clang/llvm posts a while back) was that they tend to assume that anything with undefined behaviour in the spec returns a value that makes the code faster (eg. by simply ignoring the statement altogether).

edit: http://blog.llvm.org/2011/05/what-every-c-programmer-should-...

I am wondering if in a lot of code taking this inverse square root is not necessary like when calculating length = sqrt(x^2+y^2) in a lot of code, you just want to know a minimum of maximum value so getting the min or max of x^2+y^2 is what you want and calculating the sqrt is not necessary.

AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.