TITLE: If I have a $0.00048\%$ chance of dying every second, how to numerically calculate the chance I have of dying in a day?
QUESTION [36 upvotes]: Hypothetically, if I have a 0.00048% chance of dying when I blink, and I blink once a second, what chance do I have of dying in a single day? 
I tried $1-0.0000048^{86400}$ but no calculator I could find would support this.  How would I work this out manually?

REPLY [4 votes]: The best way to compute this kind of quantities on a computer is using the functions expm1(x) and log1p(y), which compute, respectively, $e^x-1$ and $\ln(1+y)$, and are more accurate than the naive formulas for tiny values of their argument. They are part of the IEEE floating point arithmetic standard and are provided in the standard libraries of most programming languages.
Rewrite your probability as $$1-(1-p)^n = -(e^{n \ln (1-p)}-1) = -\operatorname{expm1}(\operatorname{log1p}(-p)*n).$$
So, for instance, in Python you'd use the following
In [1]: from numpy import expm1, log1p
In [2]: -expm1(log1p(-4.8e-6)*86400)
Out[2]: 0.33947545556966929

In this case the number 0.339 is rather large, so the last subtraction is tame and some of these safeguards are not needed, but for better accuracy for all values of $p$ and $n$ you should use these library functions.