How could the function $$f(x)=\frac{\sin x}{(x^2+1)^{1/2}-1}$$ be computed to avoid loss of significance?
I know that $$f(x)=\frac{\sin x((x^2+1)^{1/2}+1)}{x^2}$$ But $x^2$ has a problem.... How to solve this problem??
How could the function $$f(x)=\frac{\sin x}{(x^2+1)^{1/2}-1}$$ be computed to avoid loss of significance?
I know that $$f(x)=\frac{\sin x((x^2+1)^{1/2}+1)}{x^2}$$ But $x^2$ has a problem.... How to solve this problem??
The main problem with the original form seems to be the subtractive cancellation in the denominator. This goes away when you rewrite to $$ f(x) = \frac{(\sin x)(\sqrt{x^2+1}+1)}{x^2} $$ You may still have a problem in the denominator if $x$ can be so small that $x^2$ underflows -- but it would seem that this could be taken care of by $$ f(x) = \frac{\sin x}{x} \cdot \frac{\sqrt{x^2+1}+1}{x} $$