Subj : Re: sqrt algo To : comp.programming From : =?iso-8859-1?q?Asbj=F8rn_S=E6b=F8?= Date : Wed Jul 13 2005 04:41 pm himanshu bafna writes: > Hi > > Can anyone shed light on an Algorithm for finding out the square root > of a number? to make it simple lets only consider integers. Here is an iterative one (from the ancient Egypt, I have been told): current_estimate = 0.5*(previous_estimate + number/previous_estimate) You'll have to terminate it when you are "close enough". (It converges quite quickly, the number itself may serve as the first estimate.) Asbjørn -- Asbjørn Sæbø, post.doc. Centre for Quantifiable Quality of Service in Communication Systems Norwegian University of Science and Technology .