In this article a rational approximation f(z)
for g(z) = log_2(1 + x) - x
is used for fastlog2
but when plotting f(z)
and g(z)
they look very different.
Oddly enough the results of fastlog2
are very accurate. If I adjust f(z)
to resemble g(z)
more closely (parabola) the results turn out to be very inaccurate.
My question is:
Why are the results for fastlog2
very accurate for a f(z)
that looks very different from g(z)
and how would you find f(z)
for better accuracy?
With some help from the comments I realized what my mistake was and adjusted the formula accordingly which leads to the expected result: