Notice in the code below that the output suddenly becomes 0.0
for 0.0005**99
.
In [1]: 0.0005**97
Out[1]: 6.31e-321
In [2]: 0.0005**98
Out[2]: 5e-324
In [3]: 0.0005**99
Out[3]: 0.0
In [4]: 0.0005**100
Out[4]: 0.0
I was expecting to see an Underflow
error or some kind of a warning that this happens.
I'm coding a spam filter using the Naive Bayes algorithm, and computations like you see above are common for lengthy messages. Although I can add some mathematical workarounds, I still think it's problematic that this "conversion" to 0.0
happens silently.
I ran the code above in Python 3.7.3.