SQRT Function without math.h header C?

I do not remotely understand how to implement Newton's Method for finding Nth SQRT,
because I have a lack of understanding of it and I do not know how to turn a concept in C coding.

I am in serious need of help, PLEASE NOTE that the problem is that I do not know where to start and I am beginning C student in a class. (Which means I have a lack of knowledge for many functions of C except the ones that were given to me.)

That is how far I've gotten, I cannot go any further because I do NOT understand how the hell to translate Newton's Method to code. Theoretically I could do the work on paper but
THAT DOES NOT MEAN I UNDERSTAND WHAT MY MATH ON PAPER MEANS IN C CODE because I just don;t, there isn't a sort of book on how to do that either.

Now I'm braindead, yes I understand that I must loop this until it meets a required precision of some sort.

However I cannot begin to loop if I don't have a working equation for Newton's Method.
I LITERALLY do not know how to write X to the power of n -1 in C, serious I really don't. I have NEVER EVER in my life used exponents once on C. I'm not sure if it is as simple as writing x ^ n -1 in C.

That is just a part of it, but would that work? This is only a part of the guess but generally I want it to say i is already set to 2, therefore for some number n, that loop will run until i = n and therefore change POWER by multiply by x1 everytime.

Right right I fixed it when I noticed the two issues myself!
My teacher threw an odd ball at me, we have to check for the Absolute value of the new value minus the old value but tells us we cannot use the ABS function (Because god knows why)

Re: SQRT Function without math.h header C?

Posted 07 October 2013 - 03:33 AM

Quote

(Because god knows why)

ROFL!

To find the ABS, difference between two values, just set the two values to positive values, (-N * -1 then), and subtract the smaller of the two values, from the larger of them. ABS values are always real numbers, always positive.

Re: SQRT Function without math.h header C?

Posted 07 October 2013 - 03:47 AM

Adak, on 07 October 2013 - 03:33 AM, said:

Quote

(Because god knows why)

ROFL!

To find the ABS, difference between two values, just set the two values to positive values, (-N * -1 then), and subtract the smaller of the two values, from the larger of them. ABS values are always real numbers, always positive.

Ok I'm not sure if the ABS part if the reason why this won't work properly. Could you check if my coding is right for Newton's method?