Created
August 29, 2012 14:44
-
-
Save aoisensi/3513629 to your computer and use it in GitHub Desktop.
MySqrt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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