This is about the Babylonian method of calculating a square root of some number, sorry i did get the code from another source but anyway:
First, ask for the value “n” and declare a function.
Use the parameter x and eps which is a really small number.
“R” is the same value as “x”, a copy.
While the absolute value of “x – r * r” is greater than eps, it will loop doing a multiplication of 0.5 and some weird adition of r and x / r.
And obviously return r.
Source: http://www.okomestudio.net/cs4bum/?p=76
WSQ 13 by chozacastro is licensed under a Creative Commons Attribution 4.0 International License.