instagram

Algorithm to find exact square root in java

This is the algorithm to find exact square root in java. We are going to use binary search to get exact result.

Here in blow program, We are comparing output with Math.sqrt

Output:

To get more details about how square root has been implemented by Math.sqrt() then read below article
https://www.quora.com/How-do-computers-compute-the-square-root-of-something

Share