Custom Square Root Function!

This square root estimator works because of a math equation I came up with:
sqrt(a)=sqrt(a/b)*sqrt(b)
It recursively calls that that until an a value equals 1 or less. It then uses a lookup table to find that square root.

1 Like

So your formula uses the sqrt algorithm twice along with dividing and multiplying values? Doesn’t that just make it slower than just using the standard sqrt() method? Besides, if you were making a custom sqrt function, i’m guessing you would either be doing it for efficiency sake (very hard), or for a challenge where you must create the function without using the sqrt function within it. So this approach doesn’t really sit right with me, unless I got something wrong…

I believe it does it recursively, so it would work without the standard Math.sqrt() function.

It’s the challenge.