double sqrt1(double x){ double low = 0.0; double high = x; const double EPSILON = 0.001; // e 精度 double mid = (high + low) / 2; while (high - low > EPSILON){ if (mid * mid > x){ high = mid; } else low = mid; mid = (high + low) / 2; } return mid; }
点赞 评论
牛客网
牛客企业服务