Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 10dee49

Browse files
Refine
Signed-off-by: begeekmyfriend <begeekmyfriend@gmail.com>
1 parent a209eaa commit 10dee49

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

‎069_sqrt/sqrt.c‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@ static double mySqrt(double n)
2929
/* f(x) = (x - x0)f'(x0) - f(x0) = 0 First order of Tylor series */
3030
double x = 1.0;
3131
while (fabs(x * x - n) > 1e-8) {
32-
x = x - (x * x - n) / (2 * x);
32+
// x = x - (x * x - n) / (2 * x);
33+
x = (x - n / x) / 2;
3334
}
3435
return x;
3536
}

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /