Skip to content

Commit b21e237

Browse files
authored
Update 1.1.2 已知sqrt(2)约等于1.414,要求不用数学库,求sqrt(2)精确到小数点后10位.md
mid*mid < 2 是错误的,应该是mid * mid > 2.
1 parent ea3d939 commit b21e237

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

1.1.2 已知sqrt(2)约等于1.414,要求不用数学库,求sqrt(2)精确到小数点后10位.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ double sqrt2( ){
2525
double low = 1.4, high = 1.5;
2626
double mid = (low + high) / 2;
2727
28-
while (high low > EPSINON){
29-
if (mid*mid < 2){
28+
while (high - low > EPSINON){
29+
if (mid*mid > 2){
3030
high = mid;
3131
}
3232
else{

0 commit comments

Comments
 (0)