I need to work in log space because in some cases the denominator gets so small that underflow can happen.I can represent a value with 7 decimals on my computer.
Now the problem is that when i convert these values back to normal scale then i don't get the result what i expect and i don't know if there is any other way to interpret these probabilities.
Example :
double val = Math.log10(5) - Math.log10(10);
System.out.println(Math.exp(val));
I get the output as $0.7400..$. But the actual probability is $5/10 \rightarrow 0.5$. The above value from the logarithmic space is too high. What i am doing wrong?
It's because
Math.Expis $e^x$, not $10^x$. Change eachlog10tolog.