2022-01-20

Iterative calculation of $\mathrm{log}x$
Suppose one is given an initial approximation of $\mathrm{log}x,{y}_{0},$ so that:
${y}_{0}=\mathrm{log}x+ϵ\approx \mathrm{log}x$
Here, all that is known about x is that $x>1$. Is there a general method of improving that estimation using only addition & multiplication, i.e. without exponentiation or logarithms?
${y}_{1}=f\left({y}_{0},x\right)=?$

Joseph Lewis

Expert

Instead of solving $y-\mathrm{ln}\left(x\right)=0$ for y you can solve $g\left(y\right)={e}^{y}-x=0$
Given initial approximation ${y}_{0}\approx \mathrm{ln}\left(x\right)$ you can try to solve y using Newtons

jgardner33v4

Expert

Consider the fact that the number you are working with is a floating point number, then the log of it is
$\mathrm{log}\left(b\right)=\mathrm{log}\left({2}^{\mathrm{exp}}\cdot 1.S\right)$, where exp is the exponent and S is the significand.
$\mathrm{log}\left(b\right)=\mathrm{exp}\cdot \mathrm{log}\left(2\right)+\mathrm{log}\left(1.S\right)$
Since 1.S is between 1 and 2, assume it to be 2 then
$\mathrm{log}\left(b\right)\sim \left(\mathrm{exp}+1\right)\cdot \mathrm{log}\left(2\right).$
a couple iterations should give the correct value then.

Do you have a similar question?