mirror of
https://github.com/TheAlgorithms/C-Plus-Plus.git
synced 2026-02-11 06:26:05 +08:00
Merge pull request #768 from pastor-robert/master
fix: sqrt_double hangs on x < 1 (#760)
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user