The terms in the first expression have floating point errors of about $(1+|x|)\mu$ where $\mu$ is the machine constant, $1{\rm ulp}$ or relative precision of the floating point data type. So in the difference you get errors of up to $2(1+|x|)\mu$. However, the exact value of the expression is, by binomial expansion, $\frac{2x}{\sqrt{1+x}+\sqrt{1-x}}$, which for small $x$ is about $x$. Thus the relative error close to $x=0$ will be large.

The same happens with the second expression, if it were $1+\cos(x)$. The floating point error of the sum, which effectively is a subtraction, is bounded by $(1+|\cos(x)|)\mu\le 2\mu$, while the equivalent expression $\frac{\sin^2(x)}{1-\cos(x)}$ shows that the difference can become arbitrarily small. For $|x-\pi|<\sqrt{\mu}$ the original expression will evaluate as zero, giving relative error $1$, which is slightly more catastrophic than in the first task where that happens only for $|x|<\mu$.
