1. Basic principles explained
2. Apply Newton iteration method to find the root number
Find √a
That is to solve the equation: x²-a = 0
#define ABS(val) (((val)>0)?(val):(-(val))) double my_sqrt(double a) { double k = 1.0; while(ABS(k*k-a)>1e-9) { k = (k+a/k)/2; } return k; }