The law of tangents can be used to compute the angles of a triangle in which two sides and and the enclosed angle are given. From : \tan\tfrac12(\alpha-\beta) = \frac{a-b}{a+b} \tan\tfrac12(\alpha+\beta) = \frac{a-b}{a+b} \cot\tfrac12\gamma compute the angle difference ; use that to calculate and then . Once an angle opposite a known side is computed, the remaining side can be computed using the
law of sines. In the time before electronic calculators were available, this method was preferable to an application of the
law of cosines , as this latter law necessitated an additional lookup in a
logarithm table, in order to compute the square root. In modern times the law of tangents may have better
numerical properties than the law of cosines: If is small, and and are almost equal, then an application of the law of cosines leads to a subtraction of almost equal values, incurring
catastrophic cancellation. == Spherical version ==