In this work, we consider the properties of the two-term Machin-like formula and develop an algorithm for computing digits of π by using its rational approximation. In this approximation, both terms are constructed by using a representation of 1/π in the binary form. This approach provides the squared convergence in computing digits of π without any trigonometric functions and surd numbers. The Mathematica codes showing some examples are presented.