Estimate the square root of an integer */
| 405 | |
| 406 | /* Estimate the square root of an integer */ |
| 407 | static int est_square_root(int x){ |
| 408 | int y0 = x/2; |
| 409 | int y1; |
| 410 | int n; |
| 411 | for(n=0; y0>0 && n<10; n++){ |
| 412 | y1 = (y0 + x/y0)/2; |
| 413 | if( y1==y0 ) break; |
| 414 | y0 = y1; |
| 415 | } |
| 416 | return y0; |
| 417 | } |
| 418 | |
| 419 | /* |
| 420 | ** The main and default testset |