I am looking to find a numerical solution to the equation:
$$\frac{e^x}{2} = 1 + x + \frac{x^2}{2!} + \dots + \frac{x^{k-1}}{(k-1)!}$$
where $k$ is of the order of $10^7$, and the solution is accurate to at least 2-3 decimals. It is not hard to show that the equation has exactly one positive solution (just differentiate and use induction).
Roughly, it measures how good of an approximation is the Taylor expansion of $e^x$ upto $k$ terms. Thus, as $k$ increases, we can expect $x$ to increase as well, as the accuracy of the expansion increases farther from the origin. We can get an lower bound on $x$ by the Taylor's theorem on $e^x$, as the remainder here is $\frac{e^x}{2}$, so $\frac{e^x}{2} \leq \frac{e^x}{k!}x^k$ which implies $\sqrt[k]{\frac{k!}{2}} \leq x$. Thus by Stirling's formula, we see that the lower bound is almost $\frac{k}{e}$.
My first idea was to use binary search, by simply computing the entire function and checking its sign. I coded it up in Python, but unfortunately, it only works for values of $k$ upto about $1000$. Beyond that, the values get too big to fit in its numeric data type. I tried many other ways, like Newton's method which did not work out, amongst other things. The main problem here is I can't find a way to avoid computing the entire function (which will overflow). I have tried hard to solve it, but couldn't do it so hopefully you all can help.
This is the exponential sum function. Letting $k=n+1$ and using identities with the incomplete Gamma function and the regularized Gamma function, the problem can be rewritten as solving:
$$Q(n+1,x)-\frac12=0$$
The problem is then tractable, as the main problem is numerically evaluating the function due to a significant amount of cancellation and the fact that $e^x$ simply becomes $\infty$ near the root in double precision as you have said.
We can now evaluate this using WolframAlpha in the above form. In only a few secant iterations, we find that the desired root for $n=10^7$ is then
$$x=10000000.666666668\dots$$
It is interesting to note that the root seems to remain between $n$ and $n+1$, which makes sense when working out the Stirling approximation with the Taylor remainder.