Declare a, b, m, X, with suitable data types.
Ask the user politely to input a positive real number X;
If X is one, then output one;
If X is greater than 1, then let a = 1, b = X;
If X is less than 1, then let a = X, b = 1;
// from the observation from Fact 1,
// the solution must lie between a and b.
As long as b – a is more than 0.000001 times a, do
Let m = the midpoint of a and b;
If the square of m is equal to X,
Escape from the loop; (*)
If the square of m is more than X,
Let b = m;
If the square of m is less than X,
Let a = m;
Output the midpoint of a and b, claim it as ;