Merge pull request #768 from pastor-robert/master

fix: sqrt_double hangs on x < 1 (#760)
This commit is contained in:
Ayaan Khan 2020-05-21 15:23:29 +05:30 committed by GitHub
commit d963df6fa6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -6,6 +6,9 @@ number in O(logn) time,
with precision fixed */
double Sqrt(double x) {
if ( x > 0 && x < 1 ) {
return 1/Sqrt(1/x);
}
double l = 0, r = x;
/* Epsilon is the precision.
A great precision is