I am facing a problem with natural logarithmic function in fixed-point notation.
Let's say
$$x = 0.54, \qquad\text{then}\qquad \ln(x) = -0.616186, \qquad\text{a negative number} \tag{1}$$
Then in fixed-point notation, the value of $x$ is calculated by (assuming $x$ is $\rm Q8.24$ format)
temp_var = 0.54 * 16777216 = 9059696 (fixed point value in Q8.24 format)
So,
$$x = \ln(\textrm{temp_var}) = 16.01\qquad\text{since}\qquad 2^{24} = 16777216$$
And the float (true / unscaled form) value corrosponds to
$$16.01 / 16777216 = 9.54e-7\qquad\text{a positive value}\tag{2}$$
As we can see, both $(1)$ and $(2)$ are different in both magnitude and sign.
So, I just want to know how to solve these kinds of problems at a fixed point?