Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- double mysqrt(double x)
- {
- double l = 0, r = x, mid;
- for (int i = 0; i < 1e3; i++)
- {
- mid = (l + r) / 2;
- if (mid * mid == x)
- return mid;
- else if (mid * mid > x)
- r = mid;
- else
- l = mid;
- }
- return mid;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement