// Let's see if we can use this function in place of // the sqrt() function that is in the C math library. // // If we use this function, our main program should NOT // include math.h, and our link command should NOT use "-lm". // double sqrt ( double s ) { double e; double r1; double r2; r1 = 1.0; while ( 1 ) { r2 = s / r1; e = fabs ( s - r1 * r1 ); if ( e < 0.000000001 ) { break; } r1 = ( r1 + r2 ) / 2; } return r1; }