Skip to content

Commit

Permalink
Update 1.1.2 已知sqrt(2)约等于1.414,要求不用数学库,求sqrt(2)精确到小数点后10位.md
Browse files Browse the repository at this point in the history
mid*mid < 2 是错误的,应该是mid * mid > 2.
  • Loading branch information
zhiyong0804 authored Jun 27, 2019
1 parent ea3d939 commit b21e237
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ double sqrt2( ){
double low = 1.4, high = 1.5;
double mid = (low + high) / 2;
while (high low > EPSINON){
if (mid*mid < 2){
while (high - low > EPSINON){
if (mid*mid > 2){
high = mid;
}
else{
Expand Down

0 comments on commit b21e237

Please sign in to comment.