Let $ABC$ be a triangle, such that the lenghts $(AB),~(AC)$ are almost equal and the angle $A$ is small. According to the cosine law:
$$(BC)^2=(AB)^2+(AC)^2-2(AB)(AC)\cos A.$$
(i) Explain why is the above algorithm numerically unstable for the evaluation of $(BC)$.
(ii) Find a stable algorithm for the evaluation of $(BC).$
Attempt. $(i)$ Since angle $A$ is small, $\cos A$ is evaluated as $1$, so $(BC)\cong (AB)-(AC)$ and since $(AB)\cong (AC)$, we get a cancellation error.
$(ii)$ A way to start is to write $(BC)^2=((AB)-(AC))^2+4(AB)(AC)\sin^2(A/2)$, which still has some problems though.
Thanks in advance!