float sq_root(float n){
float ret = 1.0;
float tmp = 0.0;
threshold = 1.0e-7;
while(1){
tmp = ret;
ret = (ret+(n/ret))/2;
if((tmp-ret)<threshold)
return ret;
}
}
Last edited by jbakid; 12-02-2007 at 02:36 PM. Reason: fmat & accuracy
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks