Skip to content

Instantly share code, notes, and snippets.

@aoisensi
Created August 29, 2012 14:44
Show Gist options
  • Save aoisensi/3513629 to your computer and use it in GitHub Desktop.
Save aoisensi/3513629 to your computer and use it in GitHub Desktop.
MySqrt
double Sqrt(const double &o)
{
double s = o;
double t;
if(o == 0)
{
return 0;
}
do
{
t = s;
s = (t + o / t) / 2;
}
while(s < t);
return t;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment