Converting the probability from log-log scale to normal scale

286 Views Asked by At

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?

1

There are 1 best solutions below

0
On BEST ANSWER

It's because Math.Exp is $e^x$, not $10^x$. Change each log10 to log.