# Custom Square Root Function!

**URL:** <https://forum.makecode.com/t/custom-square-root-function/14336>\
**Category:** Arcade\
**Tags:** graphics-and-math\
**Created:** [July 5, 2022, 6:13pm UTC](https://forum.makecode.com/t/custom-square-root-function/14336 "2022-07-05T18:13:31Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![thegreatone](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/thegreatone/32/5414_2.png) [@thegreatone](https://forum.makecode.com/u/thegreatone)\
**Post date:** [July 5, 2022, 6:13pm UTC](https://forum.makecode.com/t/custom-square-root-function/14336/1 "2022-07-05T18:13:31Z")

</div>

> **[My square root function!](https://arcade.makecode.com/15885-36845-10137-56520)**
>
> Made with ❤️ in Microsoft MakeCode Arcade.

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.

---

<div class="post-metadata">

**Author:** ![Sarge](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/sarge/32/19590_2.png) [@Sarge](https://forum.makecode.com/u/Sarge)\
**Post date:** [July 18, 2022, 4:07pm UTC](https://forum.makecode.com/t/custom-square-root-function/14336/2 "2022-07-18T16:07:14Z")

</div>

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…

---

<div class="post-metadata">

**Author:** ![UnsignedArduino](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/unsignedarduino/32/592_2.png) [@UnsignedArduino](https://forum.makecode.com/u/UnsignedArduino)\
**Post date:** [July 20, 2022, 5:17pm UTC](https://forum.makecode.com/t/custom-square-root-function/14336/3 "2022-07-20T17:17:27Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![thegreatone](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/thegreatone/32/5414_2.png) [@thegreatone](https://forum.makecode.com/u/thegreatone)\
**Post date:** [July 25, 2022, 4:18pm UTC](https://forum.makecode.com/t/custom-square-root-function/14336/4 "2022-07-25T16:18:16Z")

</div>

It’s the challenge.
