Probability calculation using logarithm