Each of the expressions below will suffer from catastrophic cancellation error for the given ranges of x. Rewrite the expressions so that catastrophic cancellation does not occur.
a) $\ln(x+1) - \ln(x)$ for x large
b) $\displaystyle{\frac{1-\cos(x)}{x^2}}$ for $x \approx 0.$
c) $\displaystyle{\sqrt[3]{1+x}-1}$ for $x \approx 0.$
a) $\ln (1+\frac1{x})$ which should be calculated using the Taylor series for $\ln(1+t)$ for $t=\frac1{x}$, starting with the last term which is larger than the machine epsilon and working back toward the first term, which is $t$.
b) Multiply by $\frac{1+\cos x}{1+\cos x}$ to turn this into $\frac{sin^2 x}{x^2}\frac{1}{(1+\cos x)}$ . The second term is well behaved. For the first, you can use $$\frac{\sin x}{x} = 1 - \frac{x^2}{3!} + \frac{x^4}{5!} - \cdots$$ again starting from the last term larger than epsilon. I don't really like this answer, since it relies on the Taylor series for $\frac{\sin x}{x}$ and the other answers don't rely on series as long as you have the transcendental functions avialable.
c) This one is harder (although in practice you can simply use the Taylor series). I might say that $$ \sqrt[3]{1+x}-1 = \sqrt[3]{x+3\sqrt[3]{1+x} -3\sqrt[3]{(1+x)^2}}$$ but the same catastrophic cancellation problem has just been moved under the cube root sign. Instead, write $$ \sqrt[3]{1+x} -1 = \frac{x}{1+\sqrt[3]{1+x}+\sqrt[3]{(1+x)^2}} $$ which is well calculated for small $x$.