I need to to evaluate the function
$f(x) = {1 - (1-A)^x \over A}$,
where $0 < A \leq 1$ and $0 \leq x \leq 1$.
A straightforward C implementation of $f(x)$ with floating-point arithmetic works fine as long as A is reasonably large, but it breaks down when A is tiny. $(1-A)^x$ is very close to 1, and subtracting it from 1 yields a small number with hardly any significant digits, which is then divided by the tiny A.
$f(x)$ appears to approach an identity function as A approaches zero, but I cannot prove that.
Is there some way to rearrange the definition of $f$ that avoids the loss of precision when A is tiny? Even better, is there a way to make it so that $f(x) = x$ for $A = 0$, without introducing a special case?