fix: sqrt_double hangs on x < 1 (#760)

This commit is contained in:
Rob Adams 2020-05-20 03:05:03 +00:00
parent d079d1fda4
commit 51eb5beab5

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